The Sabres (36-29-10) made the most of the few chances that came their way in the third period at Madison Square Garden, scoring twice despite being outshot 13-5.
"It reinforces how bad we want to make the playoffs," Sabres forward Tyler Ennis said.
"The Rangers are the top team in the East, and they've played great hockey all year. We came out and played pretty sound in all areas, and I think it shows how bad we want to make the playoffs."
Ryan Miller made 26 saves, including 13 in the final period, to secure the Sabres' third consecutive win, while the Rangers (46-21-7) missed the chance to extend their lead in the conference and remain just a point ahead of idle Pittsburgh.
Buffalo's Travis Turnbull opened the scoring with his first NHL goal early in the second period but Brian Boyle leveled the score just before the 10-minute mark, quickly directing a pass from Artem Anisimov through Miller's legs.
Drew Stafford put the Sabres 2-1 up six minutes before the end of the second with a snapshot into the top corner past Rangers goalie Henrik Lundqvist and Ennis extended the lead to 3-1 on a two-on-one rush up the ice at 14:00 of the third.
Stafford made the game safe with his second of the night two minutes later, also on an odd-man rush.
"It's pretty obvious that odd-man rushes killed us tonight," Lundqvist said. "It's tough when they can walk in and pick their corners."
Buffalo are now tied with Washington on 82 points after the Capitals blew a three-goal lead to lose 4-3 in overtime to the Winnipeg Jets.
There was more bad news for the Rangers when they learned forward Mats Zuccarello suffered a fractured left wrist blocking a shot in the first period and will be out indefinitely.