Eric Young Jr.'s two-out, RBI double off Milwaukee's Donovan Hand (1-5) in the bottom of the ninth had forged a 2-2 tie for the Mets, but the Brewers escaped further damage when Hand induced David Wright to ground into a double play.
When the Brewers came to bat in the 10th, Scott Atchison (3-3) issued a leadoff walk to pinch-hitter Caleb Gindl, followed by a Jonathan Lucroy single.
Gomez (who also homered in the fourth inning) then sliced the first pitch he saw into right field for the key blow.
Yuniesky Betancourt later added a run-scoring hit as Milwaukee took a third straight against New York in a season-ending four-game series.
Daniel Murphy went 2-for-3 with an RBI for the Mets.