Seeking their first division title since 2009, the Cardinals (91-64) have surged ahead of Pittsburgh (89-66) and Cincinnati (88-67), which dropped three games back with a 4-2 loss in Pittsburgh.
St. Louis lowered its magic number to one for clinching a postseason berth, won for the 12th time in 17 games and improved to 14-4 against the Brewers this year, including 8-1 in Milwaukee.
Carpenter's fifth-inning double was his 54th of the season, one more than Musial's total in 1953.
Lynn (14-10) allowed one run, four hits and four walks in 6 1-3 innings with seven strikeouts. He had been 0-5 with a 5.44 ERA in eight starts since winning at Cincinnati on Aug. 4.
Yovani Gallardo (11-10) gave up two runs and four hits in seven innings and dropped to 1-11 with a 6.46 ERA in 17 career starts against St. Louis.
Matt Adams hit a two-run homer for the second straight night, putting the Cardinals ahead in the first. Davis hit an RBI grounder in the bottom half, but the Cardinals blew open the game in a five-run eighth.
Davis doubled in a run in the bottom half against Seth Maness.
NOTES: Brewers players drove through the parking lots and tossed bobbleheads and T-shirts to surprised tailgaters after batting practice, part of an effort to thank fans at the end of a disappointing season. ... Cardinals GM John Mozeliak said that INF-OF Allen Craig's left foot will be re-evaluated at the end of next week. He's missed 16 games since spraining his left foot Sept. 4 at Cincinnati. ... Mozeliak said that team will remain flexible in how it closes games. Edward Mujica's 37 saves leads the club, but his recent struggles force the Cardinals into a closer-by-committee approach. ''So, just having somebody labeled our closer right now, we can't do that,'' the GM said. He added that there still was enough time yet this season to correct the problem.
Link to box score: St. Louis 7 at Milwaukee 2
Link to game discussion at The Cardinal Nation message board