Alfredsson, who played his 800th regular-season game, opened the scoring with his 14th goal 6:32 in. He got his second goal of the period -- his 15th of the season -- on a power play at 18:53.
"I got a great response from the crowd," Alfredsson said. "I really appreciated that and obviously it's fun when you can win games when you get to an even number like that."
Senators defenseman Wade Redden has been Alfredsson's teammate since he debuted with the team a year after the Swedish right wing won the Calder Trophy as rookie of the year in 1995-96.
"It's a lot of hockey that we've played together," Redden said. "There's been a lot of games and a lot of good times. I'm obviously happy for Alfie and he's well deserving of the chants at the end, calling his name. He's been our best player all year, so it's great for him."
Shean Donovan scored in the second period for the Senators, who improved to 15-2-0.
"We made some mistakes -- obviously, they did also, but I think our mistakes were a lot bigger," Roy said. "They generated a lot of momentum on the power play and they made some great plays out there. You've got to give them credit and I think you've got to live and learn, and we're going to learn from this."
Ryan Miller stopped 31 shots for the Sabres.
"I think both teams gave up a lot of chances and both goalies played pretty well tonight, but overall I think we've got to be pretty happy with pulling out a win," Alfredsson said.
The Sabres never led, extending a dubious streak to eight games. Buffalo, which has two overtime wins in its past eight games, has gone 487 minutes, 35 seconds without holding a lead in regulation since a 4-2 win in Florida on Oct. 26.
Roy drew the Sabres within one 11:27 into the third when he scored on a 5-on-3 advantage.
Senators center Jason Spezza returned to the lineup after missing six games because of a groin injury.
Roy missed a wonderful opportunity to give the Sabres an early lead when he hit the right post 3:20 in as he put a shot at a wide-open net right across the goal mouth after receiving Thomas Vanek's 2-on-1 pass from the right side.
"I was trying to go post-and-in there and it happened to go post-and-out," Roy said. "It was a great play by Thomas. I didn't even see the puck and it happened to hit my stick. It's one of those things where the puck wasn't bouncing our way for the longest time and then we finally get a break and I hit the side of the post. It just seemed like it was never going to go in but we persevered through it."
Hecht got the Sabres even 58 seconds after Alfredsson gave Ottawa a brief early lead when he batted a loose puck past Gerber for his fifth goal at 7:30.
Alfredsson restored the Senators' lead with 1:07 left in the first and Donovan extended the margin to 3-1 with his third goal 16:48 into the second.
- Sabres C Tim Connolly missed his fourth straight game because of a strained abdominal muscle.
- Senators RW Chris Neil played his 400th regular-season game.