Hamels (11-4) kept the Rockies largely at bay, limiting them to six hits and a walk while striking out seven. He broke a personal three-start winless streak.
The left-hander earned the victory while reportedly negotiating a new, long-term contract with the Phillies ahead of the July 31 trade deadline.
Pence connected for his three-run clout in the fifth inning to break open a close game as Philadelphia won the rubber match of a three-game series.
Drew Pomeranz (1-4) took the loss for Colorado, yielding five runs on five hits in a five-inning stint.
Carlos Gonzalez provided the Rockies' only RBI.
Video of Victoria’s Secret models trying to 'twerk' hits Instagram
Megyn Kelly: Santa Claus and Jesus are both white men