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
Betts, Moreland homer in 8th, Red Sox beat Rays 6-4
Mookie Betts and Mitch Moreland hit back-to-back homers for the go-ahead runs in the eighth inning and the struggling Boston Red Sox beat the MLB-best Tampa Bay Rays 6-4 on Friday night.
Sabathia gets 1st win of season as Yankees top Royals 6-2
CC Sabathia played stopper again for the Yankees in earning his first win of the season and Brett Gardner hit a two-run homer to help New York beat the Kansas City Royals 6-2 on Friday night.
Marlins end 4-game skid, scratch out win over Nationals, 3-2
The Miami Marlins' runs came home on an error, a walk and a hit batsman, helping them break a four-game losing streak by beating the Washington Nationals 3-2 Friday.
Moncada hits long homer as White Sox beat Tigers 7-3
Yoan Moncada hit a mammoth home run in the first inning, and the Chicago White Sox eventually broke the game open with five runs in the seventh on the way to a 7-3 victory over the Detroit Tigers on Friday night.
Frazier throws out Maldonado at the plate
Clint Frazier shows of the great and nabs Martín Maldonado trying to tag from 3rd on a sac fly.
Davis sees A's as perennial playoff contenders
After signing an extension through 2021, Khris Davis said he believes the Athletics can get to the playoffs "again and again, like no doubt in my mind."