ST. LOUIS -- Lance Lynn learned a lot from his 18-day stint in the St. Louis bullpen.
Lynn, making his second start since an Aug. 25 demotion, tossed 6 1/3 innings and David Freese and Yadier Molina both hit their 20th home runs of the season to lead the Cardinals to a 5-0 victory over the Houston Astros on Wednesday night.
The Cardinals, who have won seven straight against Houston, moved two games ahead of the Los Angeles Dodgers in the race for the second wild card in the National League. Milwaukee is 2 1-2 games back.
St. Louis has won three straight for the first time since a four-game streak from Aug. 21-24.
Lynn (16-7) allowed three hits, struck out five and walked two in a 102-pitch stint. It was his second successive strong effort since posting a 6.56 ERA in five August starts.
"I got away from what I was all about early on in the season," Lynn said. "I got off track, and tried to start nibbling and throwing breaking pitches.
"Now, I'm going right after hitters and it's making all my stuff better."
Lynn is 2-0 with 12 strikeouts, four walks and one earned run in 12 1/3 innings since his return.
Lynn, who leads a talented staff in wins, retired nine straight batters after Jose Altuve's double to start the game. The All-Star was removed from the rotation after an Aug. 24 outing in which he gave up four earned in two innings at Cincinnati. He made six appearances in the bullpen before returning to the rotation last Thursday at Los Angeles. He gave up one run and five hits in six innings of a 2-1 win.
Manager Mike Matheny believes Lynn has returned to the rotation a smarter and more aggressive pitcher.
"He didn't go down to the bullpen and sulk; he tried to make himself better," Matheny said. "I think he learned a lot about his demeanor. He shortened up his mechanics, really tightened everything up."
Molina said Lynn was at his early-season form. Lynn was 8-1 through the first two months of the season.
"He was outstanding, he was keeping the ball down and he was aggressive," Molina said.
Freese hit a two-run homer off Lucas Harrell (10-10) in the second inning. Harrell, winless in six starts, gave up three runs and five hits in 5 2/3 innings. He struck out seven and walked one.
"They have some guys that can hit the ball and you just want to work hard and try and get through the game," Harrell said.
Craig led off the second with a single to set the stage for Freese's shot. The Cardinals are 16-3 when Freese homers.
Molina homered in the fourth with one out to push St. Louis' lead to 3-0.
The 20 homers for Freese and Molina are both career highs.
"If you are a guy that's trying to solidify himself, that's the number that I think everybody else looks at," Freese said of the 20-homer mark. "It's nice to get to that number. We've got a good number of guys that have 20 or more. It's fun to be a part of."
Molina was pleased to get to the magical plateau.
"I can't lie, it's feels so good," he said.
Houston interim manager Tony DeFrancesco was impressed with Molina's game-calling skills as well as his new-found power.
"He's proven that he's one of the best players in the game right now both offensively and defensively," he said.
Jason Motte recorded his 37th save in 44 opportunities. Motte entered the game in the ninth inning with the bases loaded and one out, and ended it by striking out Chris Synder and Jimmy Paredes. Mitchell Boggs had struck out the side in the eighth on 12 pitches.
The Cardinals tacked on two runs in the eighth on successive hits by Jon Jay, Beltran and Holliday, and a sacrifice fly by Craig.
St. Louis RHP Jake Westbrook completed a successful bullpen session before the game. Westbrook, who strained a right oblique muscle on Sept 8, will throw again Friday. He is hoping to rejoin the rotation next week. ... Houston, which has used 11 rookies this season, has the youngest active roster in the majors, averaging 26.3 years. ... The Astros are 8-9 in September after rough stretches in August (5-22) and July (3-24). ... Former St. Louis OF Jim Edmonds was in attendance. ... Cardinals LHP Jaime Garcia (4-7, 4.24 ERA) will face Bud Norris (5-12, 4.93) in the series final on Thursday afternoon. Norris is 7-4 with a 2.61 ERA in 14 career starts against St. Louis.