The Red Sox ended a two-game skid and maintained their seven-game lead over the New York Yankees in the American League East.
Boston faced a 3-1 deficit going into the seventh and Paul Shuey came on to start the inning in relief of starter Steve Trachsel.
Shuey issued a leadoff walk to Julio Lugo and Dustin Pedroia singled, after which John Parrish replaced Shuey. David Ortiz promptly doubled home a run and Manny Ramirez was walked intentionally to load the bases, after which Chad Bradford relieved Parrish.
Youkilis then doubled to center to put the Red Sox in front and Jason Varitek's single drove in another run.
Parrish (2-2) took the loss and the win went to Javier Lopez (2-1), who recorded the final out in the seventh.