Matt Carpenter homered in two straight games entering Sunday. By contrast, Jack Flaherty had allowed at least one home run in each of his previous three starts.
Carpenter kept his streak going while Flaherty brought his to an end to lift the St. Louis Cardinals to a 2-1 victory over the Pittsburgh Pirates.
Flaherty (5-6) allowed three hits with seven strikeouts and one walk in six innings. It marked the first time he completed six innings since July 3, when he surrendered four runs in six against the Arizona Diamondbacks.
Carpenter hit a solo home run in the fifth inning - his career-high 29th of the season, tying him with Colorado's Nolan Arenado for the NL lead - and Jedd Gyorko singled to drive in a run later that inning to give the Cardinals a 2-0 lead.
St. Louis took the final two games of the three-game series to move past Pittsburgh into third place alone in the NL Central.
Bud Norris retired the side in order with two strikeouts in the ninth for his 21st save.
Flaherty recovered after giving up four runs on five hits in 5 1/3 innings of a 6-3 loss to the Colorado Rockies in his last start.
He got out of trouble twice on Sunday, first when the Pirates had runners on second and third with one out. Corey Dickerson struck out and Starling Marte grounded out to end the third inning. With runners on first and third two innings later, Flaherty forced Jordan Luplow into an inning-ending double play.
Carpenter's home run to right with one out in the fifth ended Trevor Williams' streak of 21 1/2 innings without allowing a run. That stretched back to July 6, when Williams (9-8) gave up three runs in the third inning of a 17-5 loss to the Philadelphia Phillies.
After the homer, Williams surrendered consecutive singles to Yadier Molina and Jose Martinez before Gyorko scored Molina with a single to left. Williams allowed those two runs on nine hits with three strikeouts in five innings.
Adam Frazier hit a home run off reliever Chasen Shreve to make it 2-1 in the seventh.
RHP Luke Weaver (6-9, 4.75) faces the Miami Marlins today.