Artemi Panarin scored two goals, and Igor Shesterkin made 37 saves for the Rangers (47-21-13), who have points in six straight games (3-0-3). Vladimir Tarasenko scored their lone goal in the shootout.
New York is in third place in the Metropolitan Division, one point behind New Jersey and two back of the Carolina Hurricanes with one game remaining. The Devils and Hurricanes each have two games left.
"It's a battle," Rangers coach Gerard Gallant said. "Fortunately, we're in a good spot right now. We'll see what happens in the standings over the next three days, but you look at the battles below us and those teams are battling right now, like Buffalo was tonight."
Levi is 4-1-0 in five starts since the Sabres signed him to an entry-level contract March 17. The 21-year-old has two wins in the shootout.
"I'd like to say I'm free-spirited and I definitely feel it [the pressure] but I choose not to focus on it," Levi said. "Just go out and have fun, stop pucks and let all that stuff kind of take care of itself. I'm just trying to be as good as I can for the guys. They put their heart and soul, their blood, sweat and tears into the whole season to get themselves to this point so the least I can do is help them out a little bit. The guys are awesome and played well today. I just did my job."
JJ Peterka gave Buffalo a 1-0 lead at 14:24 of the first period, scoring from in front of the net off a feed Jack Quinn, who was behind the goal line after playing the puck through Niko Mikkola's feet.
Panarin scored on the power play to tie it 1-1 at 1:01 of the second period.