He struck out twice and reached on a throwing error before deciding to make a switch at Citi Field.
"I had very terrible at-bats before,'' Alonso said. "And so I'm like, all right, mustache needs to go. Simple as that.''
After changing his look, Alonso struck out for the third time in the sixth and grounded out in the eighth.
Alonso hit his major-league-leading 46th and 47th homers Monday and ended Thursday hitless in his past 13 at-bats.
The first baseman said it was not the first time he shaved in the middle of a game, noting: "Oh, yeah, baseball players are very superstitious.''
The Mets set a team record for homers in a home game by going deep six times Thursday, routing Arizona 11-1 to complete a four-game sweep. New York won for the ninth time in 13 games and is two games behind Milwaukee and Chicago for the second National League wild-card spot.
The Associated Press contributed to this report.