The Mets trailed 3-0 entering the ninth inning, but Daniel Murphy led off with a double off closer Francisco Rodriguez (4-4), who blew his fourth save of the season. David Wright followed with an RBI single.
Duda hit the first pitch he saw from Rodriguez into the Mets bullpen in right field. It was his career-high 17th home run of the season and his third in the last four games.
Carlos Torres (5-4) pitched the eighth inning to get the win. Jenrry Mejia gave up a leadoff walk to pinch-hitter Jonathan Lucroy, but got the next three outs to record his 14th save in 16 chances.
The loss broke the Brewers' four-game winning streak.
The home run spoiled a sparkling performance by Brewers pitcher Yovani Gallardo, who allowed four hits over 7 2-3 innings.
(Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)