Gonzalez (9-4) won his third straight start, baffling the Rays on a pair of hits over 6 1/3 shutout innings. The right-hander issued two walks and struck out seven en route to the win.
Jim Johnson racked up his 51st save for the playoff-bound Orioles, who remained one game behind American League East-leading New York Yankees with one regular-season contest left.
The Yanks edged Boston 4-3 in 12 innings Tuesday.
Chris Davis' long solo homer with two outs in the fourth inning provided the only run as the Orioles evened their season-ending three-game series.
Shields (15-10) took the hard-luck loss despite striking out 15 and yielding only the one run in a complete-game two-hitter.
The right-hander became only the third pitcher in major league history to allow two or fewer hits and fan 15 but still lose a game.
Exploding whale video goes viral on Internet
'SNL': 'Anchorman 2' cast, One Direction sing 'Afternoon Delight' [VIDEO]