The power surge for Ortiz has come after he was named in a New York Times story as being among those who tested positive for performance-enhancing drugs in 2003. He hit a three-run homer against Oakland Thursday and hit a two-run shot in the third inning Friday to give the Red Sox a 3-0 lead.
Ortiz has 15 home runs for the season.
Baltimore moved in front 5-4 on a two-run homer by Aubrey Huff in the sixth off starter John Smoltz, only to have the Red Sox stage a rally of their own. Jacoby Ellsbury had a one-out single in the seventh off Jeremy Guthrie (7-10) and, one out later, Youkilis delivered his game-winning homer to left.
Smoltz (2-4) stayed around long enough to get the win, giving up five runs on eight hits in six innings.
Jonathan Papelbon struck out two in a perfect ninth for his 27th save.