Wily Peralta (3-0) gave up three runs and six hits in 6 1-3 innings as the Brewers improved their major league-best record to 15-5. Peralta stuck out six.
Will Smith pitched out of a base-loaded jam in the seventh inning. Tyler Thornberg worked a scoreless eighth and Francisco Rodriquez finished for his eighth save this season and 312th of his career, good for 19th on the career list.
Brewers center fielder Carlos Gomez was in the starting lineup as he waited to see if he would be suspended for his role in a benches clearing brawl on Sunday in Pittsburgh. Major League Baseball is expected to issue its decision on Tuesday. He went 1 for 3 with a double.
Andrew Cashner (2-2) gave up four runs and seven hits in six innings. The four runs scored against Cashner was the first time he had given up more than two earned runs his last 11 starts. It was the second longest streak in Major Leagues behind only Los Angeles Dodgers pitcher Zach Greinke, who has gone 15 starts without giving up more than two earned runs.
Peralta helped his own cause in the third inning. He led off with a double and scored on Scooter Gennett's triple. Braun drove a ball to the wall in right-center where it was caught by Will Venable, but Gennett scored easily.
Ramirez followed with his third home run of the season to give Milwaukee a 3-0 lead.
Chris Denorfia then grounded to shortstop Jean Segura, who threw to Gennett to force Alonso. But Gennett's throw to first hit a sliding Alonso in the elbow and the ball rolled into right field allowing Headley to score.
Braun's RBI single in the fifth inning scored Gomez, who led off the inning with a double, and increased Milwaukee's lead to 4-2.
Smith replaced Peralta and walked Xavier Nady. But he got Seth Smith to fly out and struck out Headley to get out of the inning.
NOTES: Brewers LF Khris Davis, who hit the game-winning home run Sunday against Pittsburgh, was a late scratch due to the stomach flu. He was replaced in the starting lineup by OF Elian Herrera. ... Padres manager Bud Black said OF Cameron Maybin, who ruptured his left biceps March 2, could be reinstated and added to the Padres' 25-man roster during San Diego's current 10-game road trip. ... Milwaukee will start Yvoni Gallardo (2-0) in the second game of the series Tuesday, while the Padres will counter with Ian Kennedy (1-3)