BOSTON -- After sleepwalking through six innings, the Boston Red Sox woke up.
AL batting leader Dustin Pedroia homered in the seventh inning to begin Boston's comeback from a four-run deficit, and the Red Sox beat the Baltimore Orioles 5-4 on Wednesday when pitcher Jim Miller threw away a bunt for a game-ending error.
Hitting cleanup for the fourth time in five games, Pedroia went 3-for-4 and raised his average to .333. He is 21-for-34 (.618) in his past eight games.
"We looked tired the first five, six innings, then we kind of turn it up," Pedroia said. "We finally swept somebody."
Boston swept the three-game series. The Red Sox had won the first two games in three of their past four series only to lose each finale.
"Anytime you get a sweep, it's nice," Boston outfielder Jacoby Ellsbury said.
Cora singled off Miller (0-1) opening the ninth, and took second on Coco Crisp's bunt single, which appeared to be heading foul before taking a weird bounce on the line.
Ellsbury, attempting to sacrifice, bunted the ball toward Miller, who threw it past third baseman Aubrey Huff and down the left-field line.
"The first bunt hits a cleat mark and kicks fair. That's just the nature of the game," Miller said. "I think if I make that throw the way it needs to be made, I've got a good chance of getting him."
Cora slid headfirst into third base and his helmet popped off. Then he jogged home with his arm raised.
"I was diving," Cora said of the play at third. "All of a sudden I looked to my right and saw the ball."
Asked whether he had ever scored a winning run without a helmet, he smiled and said, "Ah, probably not."
Boston, 48-19 at Fenway Park but 34-38 on the road, moved within three games of first-place Tampa Bay, which lost 8-4 to New York, in the AL East.
The Red Sox sold out 96-year-old Fenway for the 455th consecutive regular-season game, tying the Cleveland Indians' major league record.
Baltimore has lost six straight and 11 of 12.
"It just wasn't a good road trip," Huff said. "We didn't even win a game on the whole road trip. We knew it would be a tough road trip with these guys and Tampa at their place, but we've got a lot of young guys up here learning on the job and there's going to be a lot of lumps."
The Orioles took a 4-0 lead in the fourth against Daisuke Matsuzaka. Boston's comeback began when Pedroia homered off Jamie Walker into the Green Monster seats, his 17th home run of the season. Pedroia hit eight last year and had two in 2006, when he first came up to the majors and played in 31 games.
Boston loaded the bases with a hit batter, walk and bunt single, and Rocky Cherry came in and walked Coco Crisp, which forced home a run.
Mark Kotsay hit a two-run triple in the eighth off Miller, a drive just over center fielder Adam Jones, who crashed into the wall. Miller stranded Kotsay by striking out Jason Bay and Jason Varitek.
Justin Masterson (5-4) pitched two scoreless innings. Matsuzaka gave up four runs -- three earned -- and four hits in six innings.
With planned starter Jeremy Guthrie sidelined by arm fatigue, the Orioles gave Lance Cormier his first start since last Sept. 15 for Atlanta. Cormier allowed two hits in three innings, throwing 32 pitches. Dennis Sarfate followed with another three shutout innings, giving up only one hit, a single.
Baltimore scored when Brian Roberts doubled on the game's second pitch and Nick Markakis flied to center, where Crisp dropped the ball for an error. Crisp, who battled the bright sunshine, wasn't wearing sunglasses.
The Orioles boosted their lead in the fourth on Luke Scott's RBI double, Lou Montanez's run-scoring groundout and Guillermo Quiroz's RBI single.
Ellsbury robbed Huff of a home run with a leaping catch at the wall by the Orioles bullpen in the fifth.
Baltimore hitting coach Terry Crowley was ejected by plate umpire Jeff Nelson in the ninth inning ... Boston INF Kevin Youkilis missed his second successive game. He was a late scratch with back spams on Tuesday. "He came in here a little tighter than we hoped," Boston manager Terry Francona said. ... Mike Lowell, sidelined with a strained right oblique since Aug. 13, took BP and grounders and is expected to be activated from the 15-day DL for a game Friday in Texas. ... Baltimore 3B Melvin Mora, selected August's AL player of the month on Wednesday, was sidelined for his fifth consecutive game with a strained left hamstring. ... The Orioles fell a season-worst 13 games under .500. ... Kotsay started at first base for the first time since Sept. 2, 2006, for Oakland. ... Montanez became the first player in over 30 years to win the Eastern League Triple Crown. He batted .335 with 26 home runs and tied for the league lead with 97 RBI for the Double-A Bowie Baysox. ... Boston optioned OF Jonathan Van Every to Triple-A Pawtucket, where he was expected to play in the playoffs.