The Sabres have a 3-2 advantage in the Eastern Conference quarterfinals, having won twice in Philadelphia. Buffalo will try to advance to the next round Sunday when it hosts Game 6.
Buffalo took a 3-0 lead in the first period before letting Philadelphia back in the game.
The Sabres won it, however, when Ennis collected a slap shot by Mike Weber that bounced off the pads of goaltender Michael Leighton. Ennis quickly fired a wrist shot past Leighton for his second goal of the game.
Ennis and Thomas Vanek scored 1:27 apart in the opening period and Marc-Andre Gragnani added a power-play goal for the Sabres late in the first stanza.
James van Riemsdyk and Andrej Meszaros produced second-period goals to bring the Flyers within one and Danny Briere tied it 3:36 into the third.
Ryan Miller made 36 saves to get the win.
Leighton came into the game after Brian Boucher had given up three goals on eight shots. Leighton then stopped 19 consecutive shots before giving up the game-winner to Ennis.