Swayman was working on a shutout before New York defenseman Ben Harpur scored with 4:23 left. The 24-year-old goaltender improved to 6-0-2 in his last eight starts.
“He's been fantastic. He made really hard saves look easy,'' Bruins coach Jim Montgomery said.
The Bruins moved to 36-5-4 overall while the Rangers lost their second straight at home.
"We had some opportunities but it was just not enough,″ Rangers captain Jacob Trouba said.
Zacha opened the scoring 1:19 into the first period, redirecting a Krejci shot past Rangers goaltender Igor Shesterkin. It was Zacha's eighth goal this season and the 30th point for the former Devils forward.
"We're a good team playing with the lead. It allows us to get to our game a little faster,'' Montgomery said.
Swayman made several sterling stops in the first as the Bruins outshot the Rangers 13-11.
Bergeron, the 37-year-old Bruins captain, made it 2-0 at 4:42 of the second, snapping a shot from the high slot past Shesterkin. Bergeron continues to thrive in his 19th NHL season with 17 goals and 36 points.
“It’s a tough building to play in and great building to play in,″ Bergeron said about visiting Madison Square Garden. "The fans are always into it. So when you get that lead, it gives you confidence. And Sway kept us in the game a few times."
Swayman denied Panarin on a breakaway 13 minutes into the second.
Clifton increased the lead to 3-0 just 28 seconds into the third. It was his fourth on the season.
“They manage the puck well and make plays,'' Rangers forward Mika Zibanejad said of the Bruins. ”They took advantage of the chances that they had."
Boston was coming off a 4-1 road win over the Islanders on Wednesday. The Bruins are 8-0-1 in their last nine road games and 15-4-1 on the road this season.
“It was a huge road win for us, especially on the back-to-back,″ said Swayman, whose father, Ken, was born in Brooklyn and often attended Rangers games. “It's so special coming here. My dad talks to me every time I come here. I can't wait to talk to him about this one.”
The Rangers won at Columbus on Monday after a 2-1 loss to Montreal at home on Sunday. New York had won seven of nine home games since Dec. 5.
The Bruins are 21-3-2 against Eastern Conference opponents. ... Boston also won the previous meeting, 5-2 on Nov. 3 in New York. ... The teams meet again March 4 in Boston ... Following the game, the Bruins announced their leading scorer David Pastrnak was a fan-vote addition for the All-Star Game in South Florida. Bruins goaltender Linus Ullmark was already on the division roster. ... Panarin and Rangers defenseman Adam Fox also were added via fan vote, joining Shesterkin.
Bruins: Host the San Jose Sharks on Sunday night.
Rangers: Host the Florida Panthers on Monday night.
AP NHL: www.apnews.com/hub/NHL and www.twitter.com/AP_Sports
Allan Kreda, The Associated Press