Shields (15-10) logged his fourth victory in a row, scattering seven hits while allowing one run. He fanned five with three walks.
B.J. Upton went 4-for-4 with a grand slam while Sean Rodriguez and Ben Zobrist each drove in two runs as the Rays completed a three-game sweep of the Red Sox and moved to within 3 1/2 games of the American League wild card leaders.
Tampa Bay won for the seventh time in eight games overall.
Boston's Jon Lester (15-7) yielded four runs on eight hits over just four frames and Marco Scutaro's homer was the lone offense for the Red Sox.