Kendrick wouldn't allow another run the rest of the way and was lifted after getting the first out in the seventh so lefty Jake Diekman could face two lefthanders.
The bullpen closed matters with 22/3 innings of hitless relief that included one inning each from Ken Giles and Jonathan Papelbon, who earned his 31st save.
"I don't know if you guys know me that well, but I am a competitor and I don't want to lose," Kendrick said. "So I have to keep battling; that's what you do, keep making pitches, keep grinding and try to keep your team in the game, and we scored some runs off him."
Kendrick allowed eight hits and four earned runs in 61/3 innings, not the greatest of lines. Yet when taken into context that he was lucky to get out of a three-run first, one in which the first four batters reached base, Kendrick showed some late-season resiliency in this game.
It was only the second time in the last nine starts that he had lasted past the sixth inning.
Ben Revere went 3 for 4 with two runs scored and is now batting .315. Since June 26, he leads all major-league players with a .373 average.
"I've been finding the right holes lately," Revere said. "Hopefully, I have a good last two months."
Ryan Howard added two hits and two RBIs. He now has 79 RBIs.
The Cardinals took a 2-0 first-inning lead on Matt Holliday's two-run double to center. Later in the inning they would get another on a sacrifice fly by Jon Jay.
Kendrick entered the game with a 9.00 ERA in the first inning, and with three more earned runs, it is now 9.69.
"It's a long game and you have to battle," Kendrick said. "It's been one of those years in the first inning."
The Phillies made it 3-1 in the bottom of the first on Howard's RBI groundout.
With four third-inning runs, the Phillies took a 5-4 lead. They got an RBI groundout from Chase Utley, a run-scoring single from Howard and tied the score on Marlon Byrd's sacrifice fly.
The Cardinals' fortunes went further south when with two outs, Domonic Brown was caught in a rundown following a single by Carlos Ruiz. St. Louis threw the ball away, allowing Howard to score.
The Cardinals' remaining scare came in the eighth when Holliday sent a fly to deep right against Giles that Byrd snared with a leaping catch at the wall.
Kendrick (6-11) had given his team a chance to win, and on this night the Phillies did just that.