Pavel Buchnevich and Filip Chytil scored for the Rangers, who had their three-game winning streak end. Henrik Lundqvist made 24 saves.
Krejci went top shelf for the game-winner in overtime after Pastrnak crashed the net to draw in the defense. Halak also earned an assist on the goal.
Pastrnak tied the score at 2 at 4:27 of the third period off a play that came together when he couldn't finish a partial breakaway. Krejci later fed him the puck to the left circle, and Pastrnak snapped it home for his league-leading 24th goal.
At the time, the Bruins were without top scorer Brad Marchand, who spent the shift in the locker room for an undisclosed reason. Marchand eventually returned, and Boston later killed off a high-sticking double minor on Par Lindholm with just over seven minutes remaining on the way to overtime.
The Rangers controlled the tempo of the game up 2-0 midway through the second period before Bruins defenseman Charlie McAvoy dropped the gloves with Brendan Smith at 10:51. Boston soon killed off a five-on-three that lasted 1:02 as momentum began to shift.
The Bruins got on the board at 18:28 with some help from Lundqvist, who knocked the puck into his own net with his stick after a Jake DeBrusk shot hit off the post. Kuraly was awarded the goal, and the Bruins ended the period trailing 2-1.
Buchnevich scored the game's first goal at 14:14 of the first period. Seconds after killing a Rangers power play, Halak had his stick knocked out of his hand, and Buchnevich took advantage with a teammate screening.
New York made it 2-0 at 6:21 of the second period, with Chytil scoring off the rebound of a Ryan Strome shot after a Danton Heinen turnover gave the Rangers a two-on-one.
--Field Level Media