BOSTON (AP) -- The Boston Red Sox waited for Josh Beckett to recover from his sprained right ankle before letting him get back on the mound.
And he returned to the rotation just in time.
In his first start in 11 days, Beckett pitched six solid innings to lead the Red Sox to a 4-3 victory over Tampa Bay on Friday night, slowing the charge of the third-place Rays and extending Boston's lead in the AL wild-card race to four games. It was the second win in nine games for the Red Sox, and their first in seven tries against the Rays.
"We need him to be Beckett. We don't need him to be Beckett in name only," Red Sox manager Terry Francona said. "Despite what's been happening, we want him to have a chance to pitch effectively. So we weren't going to pitch him unless he was ready."
The Rays trailed Boston by nine games on Sept. 3 and had a chance to catch them with a four-game sweep in Fenway. But trade-deadline pickup Mike Aviles broke a fourth-inning tie with his first homer since joining the Red Sox, and Boston assured itself of the wild-card lead at least through the end of the weekend.
"As tough as the last 10 days have been, playing in this atmosphere - this is why they work all winter," Francona said. "This is exciting. I was as nervous as can be."
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. But the best news might have been the performance of Daniel Bard , who rebounded after three straight losses to strike out three in a scoreless eighth.
"I don't know what anybody else is saying, but he's Daniel Bard . I want him pitching the eighth every game I start for the rest of my career," Beckett said. "I don't know if that's going to happen, but I'd like my chances."
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.
Beckett (13-5) left his Sept. 5 start with a sprained ankle and skipped his next turn in the rotation. He allowed three runs - two earned - on Friday night, 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.
"We're still in good position if we can get tomorrow's and Sunday's game. That still puts us in pretty good shape," Maddon said. "But it was made much more difficult tonight with the actions of the home plate umpire."
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 - his first homer since joining the Red Sox.
"He got a pitch he could reach and he whacked it," Francona said. "I don't care who hits them right now. It was nice seeing that ball leave the ballpark."
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 favors 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, who started his career with the Marlins, 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.