"It was a combination of us coming to life and his sinker staying up a little," said Toronto manager John Farrell, whose team had just two hits heading into the sixth. "Cook was that good in the first five innings."
Carlos Villanueva (5-0) allowed three runs on four hits over 6 1/3 innings to win his third consecutive start. He walked two and struck out five.
"It was kind of a test -- keeping the game within reach," Villanueva said. "Our guys came through, J.P. and Eddie, in a big way."
Cook (2-3) allowed five runs -- three earned -- on four hits and a walk while striking out one. He had allowed five earned runs in his previous four starts to drop his ERA from 20.25 to 3.34.
The victory lifted last-place Toronto to .500 and within one-half game of Boston in the AL East.
"Especially in our division, teams keep coming after you and coming after you," Red Sox second baseman Dustin Pedroia said. "We need to try separate ourselves. There's nothing wrong with getting a five-, six-run lead. ... We need to make sure we have better at-bats and try to pull away."
On the night dedicated to longtime catcher Jason Varitek, replacement Jarrod Saltalamacchia hit a three-run homer in the second inning to break a scoreless tie. It was his 18th homer of the year, extending his career high.
But that was all the offense Boston got.
"After the three-run homer, he stabilized the game," Farrell said. "We weren't getting much done on Cook."
Toronto made it 3-1 in the third when Kelly Johnson led off with a double and eventually scored on Brett Lawrie's sacrifice fly. Cook still had a two-hitter heading into the sixth before Colby Rasmus drew a two-out walk and Encarnacion followed with his 26th homer of the season.
Arencibia gave Toronto the lead on the first pitch of the seventh inning.
"If I had two pitches to take back the whole game, those would be the only two," Cook said. "I felt like, other than that, I was in a pretty good rhythm, putting the ball really where I wanted to. Just those two bad pitches, they made me pay for them tonight."
Yunel Escobar then reached on an error by third baseman Will Middlebrooks, chasing Cook from the game. After Rajai Davis walked, they pulled off a double-steal before scoring on Lawrie's single to left.
Davis also doubled to lead off the ninth and scored on Rasmus' fielder's choice.
The Red Sox had a ceremony before the game for Varitek, who helped the ballclub win two World Series in his 15-year career, including the 2004 title that snapped an 86-year drought. Varitek also caught four no-hitters, a major league record.
The Red Sox are worried about the first-inning troubles of RHP Josh Beckett, who has a 10.69 ERA in the first inning of his 16 starts. Manager Bobby Valentine says Beckett warms up earlier than anyone else, then takes a break before the first pitch. "This is a dog that is hard to teach a new trick to," Valentine said. ... Red Sox SS Mike Aviles got the night off with turf toe. He was injured running the bases on Friday night, Valentine said. ... Red Sox OF Jacoby Ellsbury also got the night, his first since returning from the DL. ... J.A. Happ and Brandon Lyon, who were acquired in a trade from Houston on Friday, made their Blue Jays debut. Happ retired the only two batters he faced and Lyon pitched a 1-2-3 ninth. ... Boston committed two errors for two unearned runs. Toronto had one error, which did not result in a run.