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.
Costly malfunction causes beer flood at Boston-area brewery
Megyn Kelly: Santa Claus and Jesus are both white men