Carlson broke a 2-all tie with his eighth homer of the season, a drive to left against Taylor Rogers (1-6) in the eighth.
Pujols hit a solo shot in the second and a three-run drive in the eighth to give him 689 career homers. It was his 63rd career multihomer game, tying him with Willie Mays for fifth all time.
The 42-year-old Pujols ranks fourth on the career homer list behind Barry Bonds (762), Hank Aaron (755), Babe Ruth (714) and Alex Rodriguez (696).
"I'm the grandpa in this clubhouse," Pujols said. "I'm having a great time."
Pujols has 10 homers and 30 RBIs in what he has said will be his last season.
"I've been putting some good swings all year long," Pujols said. "Sometimes, you're going to get breaks. Sometimes you are not."
Pujols has reached 10 homers for the 21st time in his career.
"To see him do these incredible things and you hear the crowd react, he's just giving the people what they want," Mikolas said. "It doesn't get any better than that."
Pujols not only did the job on the field, but he also handed out some valuable advice during the hitters' meeting before the game.
"He's got a lot of experience, he's faced a lot of guys in this league," Carlson said.
Pujols, a regular starter against left-handers, even impressed the opposition.
"He got his pitches and he did damage," Milwaukee outfielder Andrew McCutchen said. "That's what he's done his whole career."
Mikolas (9-9) permitted two runs and four hits. He struck out six and walked none.
Mikolas was coming off a rough outing. He gave up 10 runs in a 16-5 loss to Colorado on Tuesday.
"A bit of a clunker in Colorado," Mikolas said. "I stuck to my guns and stuck with what works best. Pound the zone and good things will happen."
Renfroe hit a two-run shot in the second off Mikolas, who then retired the next 10 batters. It was Renfroe's 20th homer this season.
O'Neill tied the game with his seventh homer in the sixth.
St. Louis took an 8-7 lead in the season series. The teams have four games remaining against each other.
Cardinals: RHP Jack Flaherty will make a rehab start at Double-A Springfield on Tuesday. Flaherty, who was placed on the injured list on June 27 because of a right shoulder strain, will throw 45-50 pitches in his second rehab start.
Brewers: RHP Freddy Peralta (4-2, 4.37 ERA) faces Los Angeles Dodgers LHP Julio Urias (12-6, 2.49 ERA) in the first of a four-game set on Monday in Milwaukee. Peralta will be making his 11th start of the season.
Cardinals: LHP Jose Quintana (4-5, 3.37 ERA) will take on Colorado LHP Kyle Freeland (7-8, 4.84 ERA) in the first of a three-game series on Tuesday in St. Louis. Quintana will be making his second start after coming over from Pittsburgh in a trade.