Alonso hit his 27th home run in the fourth, breaking the Mets record for most by a rookie in an entire season set by Darryl Strawberry in 1983.
With the Mets clinging to a one-run lead, Baez launched his 19th homer of the season with Kyle Schwarber and Anthony Rizzo on base and one out. Baez sent an 0-2 pitch from Seth Lugo (3-1) halfway up the right field bleachers.
''He just kind of hanged it out a bit and I got the barrel on it,'' Baez said. ''I think when I get to two strikes, I try to see the ball better and cut down my swing, which is pretty hard for me because I gotta swing hard.''
Baez learned that it was his 100th homer after returning to the dugout and being mobbed my teammates.
''It's really exciting,'' Baez said. ''I thought it was going to be a little bit later on in my career.''
Steve Cishek (2-4) pitched a scoreless eighth to earn the win in relief of Cole Hamels. Pedro Strop tossed a perfect ninth for his ninth save.
Mets starter Jacob deGrom allowed two runs and eight hits in six innings. The NL Cy Young Award winner struck out nine and walked none.
DeGrom also drove in a run with a single.
Alonso's solo shot to center came on a soft 0-2 pitch from Hamels in the fourth that Hamels said resulted from a ''mixup'' with catcher Victor Caratini. The 24-year-old had homered on Saturday to set a new mark for NL rookies before the All-Star break.
''Thankfully I saw two of them in the previous at-bat and saw it long enough and put a really good swing on it,'' Alonso said. ''I'm proud of it, but I wish we won today. It was a tough loss.''
Alonso connected in his 77th game while Strawberry hit 26 in 133 games in 1983. The Mets' record for homers in a season is 41, shared by Carlos Beltran and Todd Hundley.
Baez said he talked to Alonso during the series and tipped his cap to the rookie.
''He doing something amazing,'' Baez said. ''He's almost got 30 homers and we've still got two more weeks until the All-Star break. I like the way he's playing the game and the way he's hitting the ball.''
Strawberry also took note.
''Congrats to Pete for breaking my record which has stood for a long time,'' Strawberry said in a statement. ''What he's done in a short period of time is most impressive. No goal seems out of reach.''
Alonso is nearing Mark McGwire's major league record for homers by a rookie before the All-Star break, 33 set in 1987.
Tomas Nido also homered for the Mets.
Hamels helped his cause with an RBI single and Rizzo drove in Chicago's other run as the Cubs salvaged a split in the four-game series.
Hamels yielded three runs on seven hits through seven innings.
NEW YORK STATE OF MIND
Mets manager Mickey Callaway cursed at Newsday reporter Tim Healey, and pitcher Jason Vargas had to be restrained from charging him during a confrontation in the team's clubhouse after the game.
Reporters asked repeatedly after the game about Callaway's decision to stick with Lugo instead of going to closer Edwin Diaz. After the press conference, Callaway walked past Healey in the clubhouse. Healey told Callaway he would ''see you tomorrow,'' and Callaway responded by calling Healey an obscenity. Callaway walked away and then returned, cursing at Healey again and telling him to leave the clubhouse.
Vargas then stared down Healey and eventually tried to charge him. Players stepped in to restrain the veteran left-hander.
No punches were thrown, and Healey left the clubhouse moments later.
RHP Craig Kimbrel is expected to pitch at least one more time for Triple-A Iowa, probably Tuesday, before the Cubs consider recalling the closer, manager Joe Maddon said.
After tossing a scoreless inning Friday, Kimbrel threw again Saturday as an opener for Iowa in a rain-shortened contest. The right-hander allowed a run and got two outs as he pitched in back-to-back games for the first time since finalizing a three-year, $43 million deal with the Cubs on June 7.
Mets: Callaway said before the game he had no timeline on next steps for RHP Noah Syndergaard (right hamstring), who threw a bullpen on Saturday. ''We'll talk to the player and see exactly what we want to do next,'' Callaway said. Syndergaard is eligible to come of the 10-day IL on Wednesday.
Cubs: Chicago activated RHP Tony Barnette (right shoulder inflammation) off the 60-day injured list and optioned RHP Rowan Wick to Triple-A Iowa. Barnette, 35, started the season on the IL. He went 2-0 with a 2.39 ERA in 22 relief appearances for Texas in 2018 before a shoulder strain ended his season in early July.
Mets: LHP Steven Matz (5-5, 4.28) faces Phillies RHP Zach Eflin (6-7, 2.83) on Monday as the Mets open a four-game series in Philadelphia. Matz is 1-2 with a 5.87 ERA in four starts in June.
Cubs: LHP Jon Lester (6-5, 4.13) takes the mound on Monday against Atlanta RHP Julio Teheran (5-5, 3.40) as Chicago opens a four-game series against the NL East-leading Braves.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports