Josh Beckett (13-5) returned from a skipped start for another strong outing against the Rays, who trailed Boston by nine games on Sept. 3 and had a chance to catch them with a sweep in Fenway. It was Boston's second win in nine games and its first in seven tries against the Rays.
Jonathan Papelbon pitched the ninth for his 30th save — his first since Aug. 18 — striking out Evan Longoria with a runner on second to end the game.
James Shields (15-11) lost for just the second time since July. Longoria homered for the second straight night, and Desmond Jennings had three hits for the Rays.
Boston ace Jon Lester faces Jeff Niemann on Saturday.
In two previous starts against Tampa Bay this season, Beckett pitched 17 scoreless innings, allowing just a pair of infield singles. But he ran into trouble early on Friday when Jennings led off the game with a bunt single and took second on Beckett's throwing error; two batters later, Longoria homered off the top of the Green Monster.
The Red Sox tied it in the bottom half on RBI singles by Dustin Pedroia and David Ortiz. The teams matched runs in the third before Aviles, who was acquired from the Kansas City Royals on July 30, sent one off the billboard behind the Monster Seats.
Beckett, who left his previous start with a sprained ankle and skipped his next turn in the rotation, allowed three runs — two earned, giving up seven hits, an intentional walk and a hit batter while striking out seven. He fanned John Jaso with a runner on third to end the sixth — a called strike that got Rays manager Joe Maddon ejected.
Reliever Alfredo Aceves struck out Casey Kotchman with runners on second and third to end the seventh and Daniel Bard, who blew an eighth-inning lead on Wednesday, struck out three batters in the eighth to protect the lead for Papelbon.
Shields allowed four runs on seven hits and three walks, striking out four in seven innings.
Longoria also saved a run in the field when he dove to his right to snare Pedroia's liner and essentially landed on third base, doubling off Aviles to end the seventh.
Notes: Game 3 of the four-game series is Saturday, with LHP Lester (15-7) facing RHP Niemann (10-7). It could be the only game in the series with a pitching matchup that favours Boston. Lester will be trying to atone for his last performance — four innings pitched in a 9-1 loss to the Rays last Sunday. ... Beckett earned his 1,000th strikeout with the Red Sox when he fanned Ben Zobrist in the sixth. ... Maddon was ejected arguing a called third strike. Earlier, B.J. Upton argued a called third strike, and Maddon rushed out of the dugout to get between him and home plate umpire Hunter Wendelstedt. ... An odd play in the top of the eighth: Johnny Damon was hit by a pitch, but the Red Sox appealed to third base umpire Bob Davidson, who said he swung at the pitch for strike three. ... The Red Sox allowed a season-high seven stolen bases, three by Damon and two by Jennings. ... The Rays fanned 15 times and went 2 for 13 with runners in scoring position.Suggest a correction