The loss also cost the Brewers an opportunity to pad their lead in the National League Central, as Pittsburgh, St. Louis and Cincinnati all lost. The Pirates and Cardinals remain three games back, with the Reds six games out.
"It is frustrating," said Rodriguez, who blew his fourth save in 33 opportunities. "When you don't get your job done, it is frustrating, definitely. When you let your team and everybody down, it is frustrating. Fortunately, it is not my first rodeo. It's not my first one and it won't be my last one. That's reality. I just have to bounce back and make sure I'm ready tomorrow night."
Rodriguez, selected to his fifth All-Star game this season, came on in the ninth to protect a 2-0 lead, but allowed a leadoff double to Daniel Murphy. David Wright followed with an RBI single to left to cut the lead to 2-1.
Duda then hammered the first pitch over the right-field wall for his 17th home run.
"They jumped me right away," Rodriguez said. "First-pitch double. Wright put together a great at-bat. First-pitch homer and first-pitch base hit right up the middle. They came out swinging. Everything was up and out over the plate. Just bury it. There's nothing much I can do about it."
Gallardo allowed just four hits over 7 2/3 scoreless innings. He scattered four singles, striking out eight without walking a batter. He has not won since June 19, a span of six starts.
"Yo was great," Brewers manager Ron Roenicke said. "Command on all his pitches, got ahead of people, good curveball again today. He did a great job."
Gallardo appeared to get out of the eighth inning when he deflected a two-out grounder by pinch-hitter Eric Campbell to second baseman Rickie Weeks, who threw to first for the out.
But Mets manager Terry Collins challenged the call, which was overturned. Campbell was credited with an infield single. Rather than getting out of the inning, Gallardo was lifted for Will Smith, who struck out Curtis Granderson for the final out.
Mets starter Zack Wheeler was almost as effective. He allowed two runs -- one earned -- on three hits in 6 2/3 innings, striking out nine and walking two.
"Great stuff. Start with a 96, 97 fastball, locate it. He can throw it up when he wants to. He's got really good offspeed stuff, too," Roenicke said. "His breaking ball gave us a lot of trouble, his changeup gave us a lot of trouble. And, when you're having to cheat to catch up with that fastball, it's tough to hit all those pitches."
The Brewers pushed across an unearned run in the sixth without a hit. Weeks walked to open the inning. Ryan Braun then reached first when his routine grounder went through the legs of second baseman Murphy, sending Weeks to third.
Aramis Ramirez followed with a grounder to short, forcing Braun at second, but scoring Weeks to put Milwaukee up 1-0.
Carlos Gomez put the Brewers up 2-0 with his 15th home run, a two-out solo shot over the wall in right-center.
"We battled hard. We did a real good job getting two runs," Roenicke said. "Aramis did a nice job putting the ball in play there when he had two strikes, he kept fighting and we get a run there. Then the homer from Gomey, I thought, was big to get us the two-run lead."
Pinch-hitter Jonathan Lucroy opened the ninth with a leadoff walk off Jenrry Mejia. Pinch-hitter Logan Schafer struck out when he fouled a two-strike bunt attempt. Mejia then struck out Gomez and Weeks to record his 14th save in 16 chances since moving to the bullpen in mid-May after seven starts.
Even after missing his first two bunt attempts, Roenicke said he was confident Schafer could execute with two strikes.
"I think he's got a lot better chance to get down a bunt than he does getting a base hit," Roenicke said.
Prior to the sixth, the Brewers' only threat was in the first when Gomez beat out an infield single and Weeks was hit by a pitch. But Wheeler retired 3-4-5 hitters Braun, Ramirez and Khris Davis.
"I feel for him tonight, because that was plus stuff against an outstanding lineup," Mets manager Terry Collins said of Wheeler. "You're looking at a guy that, until Gomez hit the home run, pretty much was a dominating performance by Zack. Great we came back and didn't get the loss, and he can go home saying, 'Hey, I did my job and gave my team a chance to win, which he did.'"
Gallardo allowed consecutive singles to open the fourth, but retired the next three hitters. The only other hit he allowed was a one-out single to Murphy in the first inning.
"I felt good," said Gallardo, who remains tied with Ben Sheets for fifth-place on the Brewers' all-time victory list with 86. "I think I was able to keep the ball down to both sides of the plate. Had a pretty good curveball working. I was able to throw it for strikes and for putaway pitches whenever I needed."