Milwaukee (83-74) was six games back of the first-place Cubs in the NL Central. Chicago played at St. Louis and was one win short of clinching the division crown.
With starter Zach Davies lasting just four innings, Josh Hader (2-3) earned the win by striking out six and allowing two runs over 2 2/3 innings of relief.
Joey Votto singled with one out in the ninth off Brewers closer Corey Knebel, and pinch-runner Philip Ervin stole second. Knebel recovered to earn his 38th save by striking out Scooter Gennett and getting Eugenio Suarez to fly out to right field.
Santana connected off rookie Deck McGuire (0-1).