Matt Adams collected three hits and two RBIs while Kolten Wong homered for the second straight day as host St. Louis clinched a series victory.
Matt Holliday went 2-for-3 with two walks, two runs and an RBI and Jhonny Peralta also drove in a run for the Cardinals, who attempt to sweep the four-game set on Thursday. Lance Lynn (10-6) allowed two runs and six hits in 6 2/3 innings en route to his fourth win in six starts and Trevor Rosenthal worked around a leadoff walk in the ninth for his 27th save.
Neil Walker doubled, homered and scored twice while Jordy Mercer recorded an RBI for the Pirates, who have lost four straight on the road. Brandon Cumpton (3-3) lasted only 3 1/3 frames in his first start since June 27, surrendering four runs on nine hits and three walks.
St. Louis grabbed an early lead as Matt Carpenter led off the first inning with a single and Holliday drew a one-out walk before Adams drove in both of them with a double. Pittsburgh halved the deficit on Walker's leadoff homer in the second, but Peralta got back the run with an RBI double in the third.
The Pirates again got within a run in the fourth as Walker doubled, moved to third on a flyout and scored on Mercer's infield single. Holliday made it 4-2 with an RBI single in the bottom half and Wong launched a two-out solo shot in the seventh to cap the scoring.
GAME NOTEBOOK: St. Louis All-Star C Yadier Molina was lifted for a pinch hitter in the third inning due to a sprained right thumb and will be re-evaluated on Thursday.
Pirates OF Starling Marte was placed on the bereavement list as he returned to the Dominican Republic due to the death of his mother-in-law.
Pittsburgh purchased the contract of 1B Matt Hague, who grounded into a double play as a pinch hitter in the seventh inning in his first major-league appearance since 2012.
The Pirates are 2-for-25 with runners in scoring position over the first three games of the series.