DENVER -- Miles Mikolas had some pitches he'd rather have back. His swing was a keeper.
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. It was also St. Louis' ninth win in a row on the road.
"(Mikolas) hit one earlier in the year and we knew he was going to probably run into another one at some point," said Bud Norris, who got three outs for his 27th save, capping 4 1/3 innings of scoreless relief by the Cardinals' bullpen. "Obviously, that swing helped us win a ball game and definitely was doing your part on the offensive side, too."
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.
"They got hold of two bad breaking balls, but other than that, I thought all the other contact that inning was pretty soft, a couple bloopers, seeing-eye singles stuff, like that," Mikolas said. "I'll beat myself up over those breaking balls but other than that they got a couple of hits that weren't so good."
Besides, he can take some solace in the difference his home run made in the game.
"I've got the juice right now for our pitching staff, so that's nice. That's something that will help me go to bed tonight," said Mikolas, also tipping his cap to the bullpen for picking him up.
Carlos Martinez (7-6) picked up the victory with 1 2/3 innings of hitless relief.
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 the final out.
"The game got ugly earlier, but we didn't give up," Gonzalez said. "We put some runs (up). We scored five that inning to put us back in the game. But they also pitched well. Their bullpen came in and shut us down."
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.
"He got the ball up and they made him pay," Rockies manager Bud Black said of Senzatela. "He didn't really have any consistent secondary pitches tonight. Probably too many mistakes and just really couldn't string any pitches together all night."
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.
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.
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.
More AP MLB: https://apnews.com/tag/MLB and https://twitter.com/AP-Sports
NL East Stock Watch: Which team is having the best winter?
The division's four contenders have made the biggest moves to restock their rosters, but they're far from finished.
Schefter: Murray will go in 1st round
Adam Schefter joins SportsCenter to analyze Kyler Murray's decision to declare for the NFL draft.
Kyler Murray declares for 2019 NFL draft: Answering questions about what's next
Murray has declared for the NFL draft. Can he still play baseball? What are the key dates to pay attention to? Here's what you need to know.
Kyler Murray enters name in NFL draft, but A's can still negotiate with Heisman Trophy winner
Heisman Trophy winner Kyler Murray has announced he will enter the NFL draft, but the Sooners quarterback can still weigh his baseball options.
Derek Holland re-signs with Giants on one-year deal
Derek Holland, who made 30 starts with the Giants last season, re-signed with San Francisco on a one-year deal, the team announced.
Why next 30 days will be busiest of MLB offseason
Spring training is only a month away, and history tells us free agents don't perform as well if they miss time in camp.