Rasmus Asplund cut it to 2-1 at 18:12 off a backdoor pass from defenseman Mattias Samuelsson, and Will Butcher tied it 2-2 at 2:06 of the second period from the high slot.
Okposo put Buffalo in front 3-2 at 6:48 when he drove down the left side, cut around Rangers defenseman Adam Fox and scored five-hole.
"We're starting to figure out how to play every game, and that's something that's a very hard thing to do," Okposo said. "I'm not saying that we're there yet, because we're not, but we're starting to show some glimpses of it where we're sticking to our game no matter what.
"I think that today was a testament to that, and I've said it a lot, a ton of times, that that's the mark of the truly good teams in this league, and we're showing signs of getting there. By no means is it a finished product."
Lafreniere tied it 3-3 at 11:46, cutting to the front of the net and sliding the puck around Anderson with his backhand.
Artemi Panarin made it 4-3 for the Rangers at 3:52 of the third period, scoring on a rebound from the bottom of the right circle.