OTTAWA — The Ottawa Senators are thankful they won't be seeing the Buffalo Sabres and Robin Lehner anytime soon.

Lehner made 39 saves as the Sabres rallied past Ottawa 3-2 on Tuesday night, improving his record to 4-0-2 against his former team. This was the fifth and final meeting between the two teams with the Senators going 1-4-0 against its division rival.

"We didn't have a very good season series against them, we really didn't," said Ottawa's Bobby Ryan. "I don't want to say we looked at the roster or the standings because they've had a long season with a lot of injured players. They're a very, very good team. It's not that we played down to their level because they've continued to outplay us in a lot of areas.

"I thought (Tuesday) was the exception. I thought we truthfully deserved better."

Justin Bailey, Ryan O'Reilly and Matt Moulson scored for the Sabres (24-23-10).

Ryan, pointless in his last five, had a goal and an assist for the Senators (29-19-6). Dion Phaneuf also scored as Craig Anderson made 22 saves. Ottawa wraps up its four-game homestand 2-2-0.

Ryan has struggled offensively of late, but coach Guy Boucher says the criticism has been unwarranted.

"For me Bobby's play hasn't been an issue. To me he's just getting rewards for what he's been doing lately," said Boucher. "There's been numerous games where he's been very, very good. He's one of the guys who goes to the net and screens and sometimes you don't get points from it, but he's willing to pay the price when others don't want to. When you have a player doing that I congratulate him even if he doesn't have any points."

After a solid start to the third period Buffalo kept pushing and was rewarded as Bailey tipped Jake McCabe's point shot to take a 3-2 lead at 7:38.

Trailing 2-1, the Sabres wasted no time tying the game 51 seconds into the third as Moulson picked up a puck at the side of the net and put it over Anderson's back in front of 16,832 at Canadian Tire Centre.

"It was a great response," said Lehner, who was traded with David Legwand to Buffalo by the Senators in June 2015 for the 21st overall pick in that year's draft. "We didn't panic in the second. It was a good feeling here. It was a 2-1 game on the road and that's not a bad situation. We came back, we score a goal and they were a little bit on their heels."

Coming into the game Buffalo had given up 62 second-period goals, third worst in the league. Tuesday night was no different as the Sabres were outshot 16-7.

Ottawa made it 63 as Phaneuf jumped on a soft rebound and put the puck past Lehner to give the Senators a 2-1 lead.

Despite a lacklustre period, the Sabres felt they still had a chance. Past history against the Senators gave the Sabres optimism and confidence in Lehner had them feeling good about themselves.

"This was a gutty effort," said Sabres defenceman Josh Gorges. "We found a way. It wasn't pretty at times, it was a grinding type of hockey game and we were able to find a way, which is big. It's over now and we have to have the same kind of effort next game."

The Sabres opened the scoring on their very first shot as O'Reilly used Phaneuf as a screen and beat Anderson low glove side. The Senators tied the game at the 14-minute mark of the period as Ryan tipped Erik Karlsson's shot from the point.

Notes: D Chris Wideman was a late scratch due to a lower body injury. RW Curtis Lazar was a healthy scratch for the fourth straight game. Buffalo D Zach Bogosian returned to the lineup after missing the last six games with a rib injury. LW Evander Kane did not play due to illness and D Taylor Fedun was a healthy scratch.