The Senators kept pace with the New York Islanders with 46 points in the Eastern Conference playoff race. New York has the tiebreak edge and is in the sixth position while the Senators are the No. 7 seed.
Philadelphia lost its third in a row and is seven points behind the New York Rangers for the final post-season spot in the East.
Zach Smith gave Ottawa the lead 3:20 into the game, but Claude Giroux tied it midway through the first period.
It was still a 1-1 game as the contest headed into the final stages of regulation, but Greening produced a power-play goal with 5:36 left to put the Senators in front.
Alfredsson scored into an empty net with 7 seconds remaining.
Robin Lehner made 24 saves for the Senators, who won on the road for just the seventh time in 21 tries this season.
Ilya Bryzgalov stopped 31 shots for the Flyers.