Steven Senne, Associated Press
Boston's Alex Cora runs toward home to score the game-winning run as pitcher Jim Miller looks on.

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 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 last 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 last four series only to lose each finale.

"Anytime you get a sweep its 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."

WHITE SOX 4, INDIANS 2: At Cleveland, Nick Swisher and Alexi Ramirez homered to help Chicago avert a three-game sweep. Javier Vazquez (11-12) allowed two runs in six innings and Bobby Jenks recorded the final five outs for his 28th save.

RANGERS 1, MARINERS 0: At Arlington, Texas, Rangers fill-in starter Dustin Nippert allowed seven hits in seven innings, Milton Bradley hit a sacrifice fly in the first inning for the game's only run.

BLUE JAYS 5, TWINS 4 (11): At Toronto, John McDonald singled home the go-ahead run in the 11th inning and Toronto beat Minnesota for the eighth straight time. Minnesota lost for the eighth time in 11 games and dropped to 5-8 with one game remaining on its season-long, 14-game road trip.

TIGERS 9, ANGELS 6: At Detroit, Placido Polanco had three hits and drove in three runs, and Mike Hessman homered for Detroit, which won for the third time in 10 games. Mark Teixeira hit a home run for Los Angeles, which saw its magic number to clinch the AL West remain at eight.

National League

DIAMONDBACKS 4, CARDINALS 3: At Phoenix, Adam Dunn doubled home the winning run in the ninth inning for Arizona. For the second time in three games, the Diamondbacks rallied against the Cardinals' tattered bullpen, whose 29 losses are most in the majors.

METS 9, BREWERS 2: At Milwaukee, Ryan Church hit a grand slam and Brian Schneider added a homer in New York's six-run first inning and the Mets completed the three-game sweep. Oliver Perez (10-7) benefited from the highest-scoring first inning by the Mets in more than a year by scattering two runs, five hits and five walks and working out of several jams until leaving in the seventh.

GIANTS 9, ROCKIES 2: At Denver, Barry Zito won for the third time in four starts and Nate Schierholtz had a career-high four hits for San Francisco. Colorado had won seven of 10, including the first two games of the three-game series.

MARLINS 5, BRAVES 3: At Miami, Hanley Ramirez homered and doubled to lead Florida in front of an incredibly sparse crowd. Fewer than 600 people were in Dolphin Stadium for the first pitch. While the official attendance, based on tickets sold, was 11,211, the ballpark was so quiet that home-plate chatter could be heard.

ASTROS 4, CUBS 0: At Chicago, Randy Wolf pitched a six-hitter for his eighth career shutout and Houston won its eighth straight while Chicago lost its season-high fifth in a row. The Astros completed a three-game sweep at Wrigley Field behind the pitching of Wolf and some good defense.

NATIONALS 9, PHILLIES 7: At Washington, Cristian Guzman set a Washington franchise season record with his eighth consecutive multihit game, capping it with a bases-clearing double in the decisive eighth inning.

PIRATES 6, REDS 5: At Cincinnati, Adam LaRoche snapped an 0-for-16 slump with two RBI singles to lead Pittsburgh.