TORONTO -- Jonathan Papelbon's streak of perfection against the Toronto Blue Jays came to a costly end for the Boston Red Sox.

Fred Lewis' sacrifice fly capped a four-run rally in the ninth inning and lifted Toronto to a 6-5 victory over Boston on Thursday, just the Blue Jays' third win in 12 games against the Red Sox this season.

"He's always shut the door on us," Toronto's Aaron Hill, who scored the winning run, said of Papelbon. "It's nice to get a guy like that."

The blown save, Papelbon's first in 25 career chances against Toronto, denied the Boston right-hander his 30th save. He needs one more to become the first pitcher ever to begin his career with five straight 30-save seasons.

Trailing 5-2, Toronto's Jose Bautista chased starter John Lackey by leading off the ninth with his major league-leading 36th homer.

"Once again, there's Bautista," Blue Jays manager Cito Gaston said. "He got us going."

Papelbon (4-5) came on and blew his sixth save of the season.

"It seemed like every one of my pitches today was up in the zone," Papelbon said. "In a pressure situation, obviously, that can't happen."

Papelbon said he felt "groggy" all afternoon, both in the bullpen and on the mound.

"I didn't have much power or energy in my delivery today," Papelbon said.

Vernon Wells greeted Papelbon with a double and scored when Adam Lind lined a single up the middle. Pinch-runner Dewayne Wise stole second and moved to third when Hill singled off Papelbon's left foot.

"It seemed like it hurt a little bit," catcher Jarrod Saltalamacchia said. "He needed a second."

Papelbon stayed in the game and struck out Travis Snider, but Encarnacion tied it with a double down the line in left. Pinch-hitter Lyle Overbay was walked intentionally to load the bases for Lewis, who hit a fly ball to shallow center off Daniel Bard. Hill tagged up and slid home well ahead of the throw from Jacoby Ellsbury.

"It was down and in," Bard said of his pitch to Lewis. "He probably grounds it out half the time. It was definitely where I wanted it. He did a good job getting under it."

Kevin Gregg (1-4) pitched one inning for the win.

The Red Sox, who are second in the American League wild-card race, open a three-game series at Texas on Friday and will have to put the defeat behind them quickly.

"Whether we can or not, we're going to have to," infielder Jed Lowrie said. "We don't have a choice at this point."

David Ortiz and Lowrie hit solo homers for the Red Sox, who had won 10 of their previous 11 at Toronto.

Lackey came in having allowed 13 earned runs in 10 2/3 innings over two starts against the Blue Jays this year but was better in this one, allowing three runs and eight hits in eight-plus innings. He walked one and struck out four.

Lackey had thrown only 98 pitches when manager Terry Francona came out to replace him but wasn't about to question the decision to got to Papelbon.

"I still felt pretty strong but we've got a great closer so it's tough to argue," Lackey said.

Lowrie and Ortiz both hit solo shots in the fifth, giving Boston eight homers in the series and 155 this season. Only Toronto (179) has hit more.

Ortiz's homer was his 25th of the season, the seventh time in his Red Sox career he's reached the plateau. Only Ted Williams (14) and Jim Rice (seven) have had as many 25-homer seasons with Boston.

Lowrie's homer was his first of the season and first since a grand slam against the Cleveland Indians last Oct. 4, the final game of the 2009 regular season.

The Red Sox opened the scoring with two in the third when Victor Martinez hit a sacrifice fly and Ortiz followed with an RBI single.

Toronto cut the deficit in half in the fourth when Bautista scored on Lind's double play grounder.

Lowrie led off the fifth with a drive to center. One out later, Ortiz lined a 3-2 pitch over the wall in right.

Toronto pulled to 4-2 in the sixth on another double play, with Lewis scoring on Bautista's grounder, but the Red Sox pushed the lead back to three on Darnell McDonald's RBI triple against Scott Downs in the eighth.

Blue Jays left-hander Brad Mills allowed four runs and seven hits in 4 1/3 innings. He walked two and struck out a season-high seven.

Mills was optioned back to Triple-A Las Vegas after the game, with lefty Marc Rezepczynski coming up from Las Vegas to start Friday against the Los Angeles Angels.

Game notes

Blue Jays left-hander David Purcey injured his right foot making a play at first base in the sixth and will be evaluated again Friday in Los Angeles. ... Overbay was held out of the lineup with Lind starting at first base. ... Boston shortstop Marco Scutaro got the day off, with Lowrie starting in his place. ... Francona said left-hander Hideki Okajima (right hamstring) threw at 120 feet on flat ground Wednesday.