Lynn (10-1) allowed a run on three hits with six strikeouts to capture his sixth straight decision. His only loss this year came on May 7 in a 2-1 setback against the Cubs.
St. Louis was clinging to a one-run lead entering the sixth, but the Cardinals scored four times in that frame.
Allen Craig then came through with a two-out, two-run single and Matt Carpenter's base hit drove in another run.
Chicago's only score came on a home run by Wellington Castillo in the third.
The loss went to Scott Feldman (6-6), who was touched for five runs on six hits with four walks in 5 1/3.