Slugger Pete Alonso and the Mets are in agreement on a two-year, $54 million contract, sources said, ending a lengthy free agency with a return engagement to the only team for which he has played.