Locke (2-1) yielded just two hits and a pair of walks as the Pirates reeled off their fourth victory in five games.
Jason Grilli struck out two batters in the ninth inning en route to his eighth save of the season.
Phillies starter Cole Hamels (0-3) pitched well in the loss, allowing two runs on seven hits and a walk over eight innings. The left-hander struck out six.
Putin thinks Obama would save him if he were drowning
Rosie O'Donnell unveils nearly 50-pound weight loss