Baltimore is a game behind the first-place New York Yankees, who beat visiting Boston, 4-3, in 12 innings.
Orioles rookie Miguel Gonzalez (9-4) limited the Rays to two singles over 6 1/3 innings. The righthander walked two and struck out seven before manager Buck Showalter turned the game over to the bullpen.
Davis joined Hall of Famer Reggie Jackson as the only Baltimore players to homer in six consecutive games, connecting off Shields (15-10) in the fourth. The Orioles managed only one other hit - Nate McLouth's sixth-inning single - in Shields' 19th career complete game and third this season.
The Orioles, guaranteed at least a wild-card spot, clinched their first playoff berth in 15 years late Sunday.
The Rays won the opener of the three-game series Monday night to remain in contention for the second AL wild card, but they were eliminated a few hours later when the Oakland Athletics beat Texas to gain a trip to the postseason.
In other games *
At New York, Raul Ibanez tied the game with a two-run, pinch-hit homer in the ninth and won it with an RBI single in the 12th as the Yankees beat the Boston Red Sox, 4-3.
* At Kansas City, Miguel Cabrera went 2-for-3 and drove in two before leaving in the fifth inning as he solidified his bid for the AL Triple Crown, but it was not enough, as the Detroit Tigers fell to the Royals, 4-2.
Cabrera has 44 homers, a .331 batting average and 139 runs batted in. He holds a solid lead in all but the homer category, where late Tuesday he led Texas' Josh Hamilton by one.
* At Toronto, Chad Jenkins (1-3) earned his first major league win, Kelly Johnson hit a two-run home run and the Blue Jays beat the Minnesota Twins, 4-3.
* At Cleveland, Jason Donald singled home the winning run with two outs in the 12th inning, lifting the Indians over the Chicago White Sox, 4-3.
Tigers righthander Max Scherzer will miss his start in Wednesday's season finale after twisting his right ankle Monday night during the team's celebration at winning the AL Central pennant.
Manager Jim Leyland said someone apparently stepped on Scherzer after the Tigers had streamed out of the dugout in Kansas City and were jumping into a joyous pile behind the pitcher's mound.
It is uncertain whether he will be able to pitch for the start of the playoffs on Saturday.
* Angels lefthander C.J. Wilson will have elbow surgery after the regular season to remove bone spurs.
* White Sox slugger Paul Konerko said he will have surgery Thursday to remove a bone fragment from his left wrist.
* The Mariners announced plans to move in the outfield fences at Safeco Field for the 2013 season after years of debate about having one of the more spacious outfields in baseball.