Joe Corvo, Chris Phillips, Denis Hamel, and Peter Schaefer also scored for the Senators, who had dropped two straight and six of their previous eight games.
The Senators were without leading scorer Jason Spezza, who suffered a knee injury against Tampa on Thursday and is out indefinitely.
Ben Eager, Jeff Carter and Kyle Calder scored for the Flyers, who set a franchise record by losing their sixth straight home game. Philadelphia had dropped five straight in 1969 and 1990.
Alfredsson broke a 3-3 tie when he knocked a rebound of a Dany Heatley shot over the stick of Philadelphia goaltender Antero Niittymaki. Heatley had stolen the puck from Philadelphia defenceman Derian Hatcher.
Schaefer added a power-play goal when he put a wrist shot into a wide open net at 12:29 and Alfredsson scored a short-handed open-net goal with 25 seconds left.
Ottawa goaltender Martin Gerber had 26 saves. Niittymaki, making his 15th straight start, stopped 36 shots.
The Flyers led 2-1 after outshooting the Senators 16-7 in the first period.
Corvo put the Senators ahead at 6:09 when he slapped a one-timer from the left circle past the pads of Niittymaki on a power play.
Eager tied it at 12:30 when he hammered in a rebound of a point-blank wrist shot by Stefan Ruzicka.
Carter made it 2-1 with 2:32 left when he connected on a one-timer from the left circle.
The Senators scored twice in a span of 1:39 to take a 3-2 lead midway through the second period. Phillips flicked a wrist shot past Niittymaki at 12:34 to tie it and Hamel converted an unassisted breakaway at 14:13 to put Ottawa back in front.
Calder tied it with 1:10 left in the period when he tapped the puck into the net from right of the goal after taking a brilliant pass from Sami Kapanen, who was standing at the far left baseline.
Philadelphia centre Peter Forsberg was scratched from the lineup because of post-concussion symptoms. The Flyers are 0-9-3 when he is not in the lineup.
Notes: The Flyers three home wins are the fewest in the NHL. . . . Ottawa played 22 of their first 35 games on the road (12-9-1). . . . Alfredsson also hit the crossbar on a power play midway through the second period. . . . Heatley had two assists and extended his scoring streak to four games (three goals, four assists).