Atlanta had trailed 5-3 going into the ninth, but Andrelton Simmons hit a two-out two-run homer off Jonathan Papelbon (5-1), who blew his seventh save in 32 opportunities.
Galvis, who had four hits, got Papelbon the win by connecting on a 1-0 pitch from Freddy Garcia (0-1) into the seats in right field. It was the first four-hit game for Galvis, who had been 0-for-7 since being recalled from Triple-A Lehigh Valley on Sept. 3. It was his fifth homer of the season.
Carlos Ruiz singled, doubled and drove in three runs, and Cesar Hernandez and Kevin Frandsen each had three hits for the Phillies.
Freddie Freeman had two hits and two RBIs for NL East-leading Atlanta, which dropped its third straight.
Kyle Kendrick was in line for the victory before the ninth. Kendrick, who had lost a career-high tying four-game losing streak, retired the first six Braves before scuffling in the third inning. Freeman’s two-run double staked Atlanta to a 2-0 lead.
The Phillies tied it in the bottom of the inning on Ruiz’s two-run single. And Ruiz’s fifth-inning double put Philadelphia ahead 3-2. Galvis also had an RBI single in the fifth to give the Phillies a two-run advantage.
Chris Johnson’s sixth-inning double pulled Atlanta within 4-3, but the Phillies bullpen held Atlanta scoreless until the ninth. Justin De Fratus and Jake Diekman combined to allow one hit in two scoreless innings before turning the ball over to Papelbon.
Frandsen’s RBI single in the eighth put the Phillies back up two runs.
Kendrick matched a career high with eight strikeouts in six innings. The right-hander allowed four hits and walked three. He had been 0-4 with a 5.27 ERA in his last five starts.
Braves rookie left-hander Alex Wood gave up four runs on nine hits in 4⅔ innings.
The Upton brothers continued to struggle for Atlanta. B.J. Upton went 0-for-4 with four strikeouts while Justin Upton was 0-for-3 with a pair of strikeouts. The Uptons have combined to go hitless in their last 27 at-bats.