Jakub Voracek made it 2-0 at 13:43 of the third period when he finished a 2-on-1 with Hayes, and Hayes scored into an empty net with 1:42 remaining to make it 3-0.
The Sabres' 40 shots on goal were their most since they had 44 against the Ottawa Senators on Dec. 23, 2019.
"[Elliott] was good, but I think there were moments we could have done a better job getting to him, getting to the net and being assertive in that area," Buffalo forward Eric Staal said.
It was Elliott's 41st NHL shutout and fifth in four seasons with Philadelphia.
"He made some huge saves for us to keep that game 0-0 and kept us in the game," Flyers captain Claude Giroux said. "He's battling out there and working his butt off, and he's probably the reason we won the game tonight."
Philadelphia coach Alain Vigneault said, "We didn't play a perfect game. There are some decisions with the puck that we need to make a little bit better. But I thought overall our compete level was very strong tonight. ... We had to bounce back from our performance yesterday, and I thought our group showed some good character, and we found a way to win against a good team."
NOTES: Flyers defenseman Philippe Myers and forward Morgan Frost each will have an MRI on Wednesday after leaving the game with an injury, Vigneault said. Myers did not play in the second and third periods, and Frost left with 4:45 remaining in the second after a collision with Sabres defenseman Jake McCabe. ... The win was the 692nd in the NHL for Vigneault, moving him past Dick Irvin for ninth in NHL history. He is 692-457-105 with 35 ties in 1,289 games with the Flyers, New York Rangers, Vancouver Canucks and Montreal Canadiens.