Kolten Wong and Willy Adames also went deep for the Brewers, who reduced their magic number to two for clinching their first NL Central title since 2018. They can wrap it up Saturday with a win over the Mets and a loss by St. Louis to the Cubs in Chicago.
Milwaukee had dropped five in a row since securing its fourth consecutive playoff berth last Saturday, including four defeats at the hands of the streaking Cardinals.
"When you hit multiple homers in a game, you kind of like your chances," Yelich said. "We were raking for a few months, then we had a tough week, which happens. We definitely haven't played as well as we would have liked, but every team in baseball goes through those little rough patches."
The Brewers have a seven-game lead in the division over the Cardinals, who swept a doubleheader from the Cubs on Friday to tie a franchise record with their 14th consecutive win.
The Brewers have won 12 of their last 13 against the Mets in Milwaukee, including seven in a row.
New York (73-80) has lost 11 of 14 overall to fall a season-worst seven games under .500.
Lauer (7-5) settled down after a shaky first inning that required 39 pitches. He retired 18 of 19 batters during one stretch and held the Mets hitless after the first until Jeff McNeil's infield single in the seventh.
"I think that's the most pitches I've thrown in the first inning ever, maybe," Lauer said. "That was a little bit of a gut-check and kind of a reset after that first inning."
The left-hander gave up one run and three hits in 6 2/3 innings. He walked two and struck out nine, matching a career high, in a 114-pitch outing that saved a depleted Brewers bullpen.
"He was outstanding," Brewers manager Craig Counsell said. "In the second through seventh, it was as good as you're going to see anybody pitch. He was in command of everything. His cutter was really good. He continued to be a big key for us on a night when we needed length from our starter. It was just a huge effort."
Brent Suter and Josh Hader closed it out.
The Mets jumped on Lauer immediately. Brandon Nimmo led off the game with a triple and scored on Francisco Lindor's groundout. The Mets loaded the bases with two outs, but Lauer struck out James McCann to limit the damage.
Wong led off with a home run for the Brewers in the bottom half against rookie Tylor Megill (3-6) to even the score. It was Wong's ninth career leadoff homer, seven of which have come this season.
"I thought it was key to jump right back to even there," Counsell said. "It puts energy back in the stadium and back in the dugout."
Wong drew a leadoff walk in the third before Adames and Yelich followed with back-to-back home runs to give the Brewers a 4-1 lead. It was the first long ball for Yelich since a two-homer game on Aug. 21. Adames, who has missed time recently due to injury, hadn't gone deep since Aug. 18. He has 23 home runs this season.
Megill gave up four runs and five hits in four innings. He walked four and struck out two.
"I'm definitely not getting away with much," Megill said.
Milwaukee's lead grew to 5-1 in the fifth when Yelich lined a leadoff triple into the left-field corner off reliever Brad Hand and scored on Avisaíl García's sacrifice fly.
Mets: RHP Noah Syndergaard will make a second appearance with Triple-A Syracuse on Saturday. Syndergaard hasn't pitched in a major league game since 2019. He is recovering from Tommy John surgery in March 2020. Mets manager Luis Rojas said he's unsure if this will be Syndergaard's last rehab outing. "We'll see how he feels," Rojas said. "That'll dictate if it's the last one." ... New York ace Jacob deGrom, who hasn't pitched since July 7 because of an elbow injury, threw a 25-pitch bullpen.
Brewers: Relief pitcher Devin Williams remained unavailable with right calf soreness. Williams said he felt pain behind his knee and the upper part of his calf when a section of grass gave way while he was running in the outfield. "I think it's a minor thing and I'll be back in a few days," he said.
BREWERS HONOR TRIO
Prior to the game, Milwaukee inducted outfielder Carlos Gómez and pitchers Yovani Gallardo and Francisco Rodríguez into the Brewers Wall of Honor. Gómez, who spent six seasons with Milwaukee, officially retired Saturday as a member of the Brewers. He and Gallardo threw out ceremonial pitches.
Mets: Rich Hill (6-7, 3.87 ERA) will make his 10th career start against the Brewers. Hill is 2-0 with a 1.69 ERA in four games (three starts) in Milwaukee.
Brewers: Corbin Burnes (10-4, 2.34) has 221 strikeouts and 32 walks in 158 innings. Burnes is 8-0 with a 2.34 ERA in his last 18 starts.
Adames, Yelich go back-to-back
Willy Adames and Christian Yelich hit back-to-back home runs, each traveling 400-plus feet.