Philadelphia starter Cliff Lee remained winless in seven starts this season, but he scored in the seventh to create a 3-3 tie and escaped taking what would have been his fourth setback.
Lee doubled to open the seventh and scored the tying run on a double by Juan Pierre.
It remained deadlocked until Pierre began the 10th with a single off Jason Motte (3-2) and scored in front of Pence's 11th homer of the season.
Lee struck out seven, but gave up three runs on eight hits in seven innings. The Phillies have scored just 12 runs this season while Lee has been on the mound.
Raul Valdes (2-0) worked the ninth to get the victory. Jonathan Papelbon recorded a perfect ninth for his 14th save in as many opportunities.
Philadelphia has won three in a row after losing four straight.
Millions of Getty images now available for free via embed tool
Boston schools pull out free condoms over wrapping complaints