Peralta and Lamb belted solo shots in the eighth inning to put the finishing touches on right-hander Matt Koch's third consecutive victory. Peralta has two career two-homer games, both this season.
The Diamondbacks won for sixth time in seven games.
Brandon Nimmo, Michael Conforto and Amed Rosario homered for the Mets, who have lost 11 of 12 and 18 of 22. They have not won a series since sweeping the Diamondbacks at Citi Field from May 18-20, losing six series and splitting one.
Rosario has four homers this season, three against Arizona.
Goldschmidt has 26 hits in his past 61 at-bats (.426) with seven homers and 16 RBIs. Ketel Marte had an RBI single, and Jon Jay had his third straight multi-hit game for Arizona.
Koch (5-3) gave up three hits and two runs on bases-empty homers in six innings, with five strikeouts and one walk.
Brad Boxberger pitched a 1-2-3 ninth inning for his 15th save in 17 chances.
The Mets have scored 18 runs in their past 12 games, never more than four in one game. They have been shut out three times and scored one run twice in that span.
New York left-hander Jason Vargas (2-5) gave up five hits and three runs in five innings, the fourth time in the past five starts he has gone exactly five innings. He struck out five and walked two.
Nimmo hit his ninth homer of the season with two outs in the first inning, a ball that just cleared the right field fence.
Marte tied the game with an RBI single in the second inning after John Ryan Murphy walked and Peralta was hit by a pitch.
Goldschmidt hit his 13th homer with two outs in the third inning for a 2-1 lead, and Peralta hit his 13th to lead off the fourth to make it 3-1.
Conforto's eighth homer in the sixth inning brought the Mets within one.
Nick Ahmed was hit by a pitch with the bases loaded in the seventh before Rosario hit the Mets' third solo homer in the eighth.
--Field Level Media