Ramon Ramirez (2-0) pitched one inning for the win.
Damaso Marte (0-1) struck out three and allowed one hit, the long drive over the Green Monster for Youkilis' fifth homer of the year and his second game-ender.
Rivera came on with two outs in the eighth and struck out Dustin Pedroia with runners on first and second to end the inning. In the ninth, he gave up a one-out single to Youkilis and, one out later, Bay drove the ball off the top of the 37-foot left-field wall above the 379-foot marker.
After Mike Lowell singled, Rivera struck out Jason Varitek to send it to extra innings.
Jacoby Ellsbury singled to lead off the game, took second on a balk and then broke for third on a pitch that got by Jose Molina for a passed ball. The Red Sox center fielder never slowed when rounding third and slid into home behind pitcher Joba Chamberlain, who overran the plate and wound up sitting on it.

The Yankees scored two in the fourth, and Chamberlain held on through 5 1-3 innings thanks to four double plays. Boston finally chased Chamberlain in the sixth, tying it 2-2 with three straight hits before Phil Coke got a pair of popups to end it.
Mark Teixeira, who snubbed the Red Sox and signed with their rivals, broke a seventh-inning tie in his first appearance at Fenway Park in a Yankees uniform.