Both of Hampson's homers came on 0-2 pitches - a three-run shot in the fifth inning on a hanging curveball by Phillies starter Aaron Nola and tiebreaking a two-run blast in the seventh off Hector Neris (2-6). Philadelphia pitchers have allowed 16 homers on 0-2 counts this season, the most in the majors.
"They were attacking our hitters all day," Hampson said. "I missed some pitches early, but fouled off a few fastballs. I was able to grind it out and get a good pitch to hit."
The Rockies hit five homers on 0-2 pitches during while taking three of four games from Philadelphia after having three such homers this season coming in.
"It's bad execution," Phillies manager Joe Girardi said. "It has to get better or this is what happens."
The Phillies fell 4 1/2 games behind NL East-leading Atlanta with 19 games to play.
"It stunk, it stunk," Girardi said about the series. "There's no other way to describe it. It stunk."
The Rockies - who are 30 games below .500 (21-51) on the road - won the season series against Philadelphia 5-2. Against the Rockies and Diamondbacks - the bottom two teams in the NL West with a combined mark of 63 games under .500 - the Phillies finished the season 5-9.
"We kept saying that, how big these games are for them, but likewise it is also huge for us," Hampson said. "We want to play spoiler and play these teams tough. To come in here and take three of four in Philadelphia is pretty awesome."
Bryce Harper hit his 32nd homer of the season for the Phillies. J.T. Realmuto had three hits and scored two runs.
"We have to win every series the rest of the way," Realmuto said. "We have to sweep a few of them to catch the Braves. We can't sit around, play .500 and expect them to come back to us. We have to play better."
Sunday's start was the 30th of Nola's career in September, during which he is 7-13 with a 4.55 ERA and 30 homers allowed in 172 innings. It's the only month in which Nola carries a sub-.500 record.
Nola struck out 10 batters and induced plenty of weak contact, but the 0-2 pitch to Hampson derailed his outing and gave Colorado a 3-2 lead.
"I just made a bad pitch to Hampson there," Nola said. "I should have tried to throw it 50 feet. He put a good swing on it as he should have on a curveball down the middle."
Realmuto scored on a wild pitch from Ashton Goudeau (1-0) in the sixth to tie it.
With Elias Diaz on base and two outs in the seventh, Hampson deposited Neris' fastball in the flower bed just above left fielder Matt Vierling's glove. It was his third career multi-homer game.
Harper homered in the eighth, his 25th solo shot of the season. Only seven have come with runners on base.
Carlos Estevez worked the ninth for his seventh save.
Rockies: OF Sam Hilliard was out of the lineup, one day after being hit in the elbow by a pitch from Zack Wheeler.
Phillies: Activated C Andrew Knapp from the COVID-19 injured list, where he had been since Aug. 27. C Rafael Marchand was optioned to Triple-A Lehigh Valley.
Rockies: Begin a three-game series at Atlanta on Tuesday. RHP Jon Gray (7-10, 4.18 ERA) is scheduled to square off against Braves righty Touki Toussaint (3-2, 4.11).
Phillies: Host the Chicago Cubs on Tuesday. RHP Kyle Gibson (10-6, 3.38) will start against Chicago RHP Adrian Sampson (0-2, 2.20).
Hampson does it all in Rockies' win
Garrett Hampson drives in all five of Colorado's runs on two home runs in the win over Philadelphia.