By Sam Bush

You sort of knew that this was not going to be a great Mother’s Day for the Mets’ Jacob DeGrom against the Phils:

He needed 45 pitches to get three outs!

The Phillies fouled off 20 pitches in the first. That led to a strange scenario of deGrom being pinch hit for in the second inning of a scoreless game.

“I was kind of surprised, honestly,” deGrom said. “I definitely would have liked to have gone back out there. The reasoning, I understand. But who wants to pitch one inning as a starter?”

Pinch-hitter Nick Williams (above) had a go-ahead, three-run homer off Paul Seward in the sixth inning that carried the Phillies over the Mets 4-2.

Cesar Hernandez, Aaron Altherr and Odubel Hernandez each walked on six pitches. DeGrom struck out Rhys Hoskins, got Carlos Santana to ground back to the mound and fanned Maikel Franco to end a 10-pitch at-bat. That extended deGrom’s scoreless streak to 19 1/3 innings, the longest active streak in the majors.

The pitches were deGrom’s most in a big league inning, topping his 37 at a rookie in the first inning at Atlanta on July 2, 2014.

“I’d like to think I would have been able to figure it out,” deGrom said. “But who knows?”

The first inning lasted 39 minutes and produced no runs. Philadelphia’s Aaron Nola (6-1) worked out of a bases-loaded, one-out jam by striking out Wilmer Flores and retiring Michael Conforto on a groundout.

The Phils trailed 1-0 when Williams batted for Nola and connected on a slider with two outs off Sewald (0-3), the second of four Mets relievers. It was a highlight in a difficult season for Williams, who has been relegated mostly to the bench.

“This spot is maturing me a lot,” he said. “It’s a spot I’ve never been in, and I think it’s helped me grow as a player and a person. I think I am learning the game a lot better, and the chances I do get I think are helping me to become a complete hitter.”

Carlos Santana added an eighth-inning homer off Jeurys Famila as the Phillies won for the fifth time in six games.

Yoenis Cespedes’ sixth-inning homer was the only run off Nola, who allowed nine hits in six innings. Asdrubal Cabrera hit an RBI double in the seventh against Tommy Hunter.

Edubray Ramos worked around a walk in the ninth for his first big league save as the Phillies improved to 8-14 against the NL East. He replaced struggling closer Hector Neris, who blew a save Friday.

“We’re going to be creative,” manager Gabe Kapler said of his closer situation.

New York has lost 17 of 25 after an 11-1 start, dropping nine of its last 11.

Luis Guillorme pinch hit for deGrom in the second and singled in his first major league at-bat.