Miles Mikolas and Tyler O'Neill each homered to help St. Louis to an early lead and the Cardinals withstood a rally by Colorado to beat the Rockies 7-5 Friday night for their fourth straight win.

O'Neill also had an RBI double and Kolten Wong added three hits and a sacrifice fly for the Cardinals in a game between teams in the thick of their respective division races and running 1-2 in the NL wild-card race.

The Rockies pulled within two runs with a five-run fifth that featured a two-run drive by Charlie Blackmon and a solo shot by Nolan Arenado, both off Mikolas, who helped St. Louis take a 7-0 lead by hitting a two-run homer as part of a four-run second.

Mikolas had stranded five base runners over the first four innings but could not get out of the fifth. He was relieved by Chasen Shreve after Carlos Gonzalez scored from third on Ian Desmond's fielder's choice and Ryan McMahon hit a two-out RBI single that drove in Desmond, who had reached third on second baseman Wong's throwing error.

Carlos Martinez (7-6) picked up the victory with 1 2/3 innings of hitless relief.

Bud Norris gave up a two-out double to Ryan McMahon and walked pinch-hitter Chris Iannetta before retiring D.J. LeMahieu on a fielder's choice for his 27th save in 31 opportunities.

Leading off the second, O'Neill drove a 1-2 offering from Antonio Senzatela (4-4) deep into the left-field bleachers for his fifth home run of the season, marking the 16th straight game in which the Cardinals homered. The streak is the longest since St. Louis connected in a club-record 25 straight games in 2016.

Jedd Gyorko worked a one-out walk and Wong singled before Senzatela struck out Harrison Bader. But after Gyorko scored from third on a passed ball, Mikolas homered over the wall in straightaway center for his second of the season. The right-hander also homered for his first big league hit April 2 at Milwaukee.

The Cardinals added three runs in the fifth, moving out to a 7-0 lead on run-scoring doubles by Gyorko and O'Neill and a sacrifice fly by Wong.

TRAINER'S ROOM

Cardinals: RHP Michael Wacha threw 3 2/3 scoreless innings Thursday night in his second rehab start for Class A Palm Beach against Fort Myers. He's expected to throw a bullpen session Sunday before making a third rehab start on Tuesday, most likely at Class AA Springfield. Wacha went on the 10-day disabled list June 21 with a left oblique strain. "He's in the conversation to come back and pitch in early September but what day that looks like - he's not there yet," interim manager Mike Shildt said.

UP NEXT

Cardinals: RHP John Gant (5-5, 3.76 ERA) has posted a 2.30 ERA over his last three starts spanning 15 2/3 innings. He is making his first career appearance against the Rockies.

Rockies: RHP German Marquez (11-9, 4.42 ERA) is set to make his third career start against the Cardinals but first in more than a year. He won his previous outings against St. Louis, both at Coors Field, going 2-0 with a 2.53 ERA over a combined 10 2-3 innings.