David Pastrnak climbed back into the NHL goal-scoring lead as the Bruins won at TD Garden for the sixth straight time.

BOSTON -- If not for a thumb injury that cost him 16 games last season, David Pastrnak would undoubtedly have scored 40 goals, and Wednesday night would have been slightly less of a big deal.

An even higher number may be ahead now that the Bruins’ winger, who’s still only 23 years old, has reached and passed 40 for the first time. But Pastrnak, who climbed to 41 with his fourth hat trick of the season in a 4-1 decision over the Canadiens, is more concerned with helping the Bruins’ points total to rise.

“Obviously, I’m happy” said Pastrnak, who hit the 40-goal mark after seasons of 34, 35 and, last year, 38 in only 66 games. “It’s something I haven’t accomplished yet in my career, and I’m excited. But it was a big game for us.

“First of all, it’s Montreal, our biggest rival. They’re battling for their lives in the second half of the season, so for us it’s a great measuring stick, and that’s where we were focusing. We know teams are coming from behind us, and we knew we needed these big two points. I think we played a really good game tonight.”

Pastrnak re-established himself as the NHL’s goal-scoring leader on the same night the Bruins made sure they’d still sit atop the NHL standings when they play their next game, against the Red Wings on Saturday. Wednesday night’s victory pushed the B’s three points ahead of the Lightning, who will try to creep back within a point when they host the Oilers on Thursday night.

Pastrnak, who became the first Bruin to score 40 goals or more since Glen Murray (44) in 2002-03, was clearly the Bruins’ biggest star on Wednesday, but he wasn’t the only one. Brad Marchand registered three assists -- two on Pastrnak goals -- and Tuukka Rask stopped 28 shots to improve to 13-0-6 this season at the Garden, where the B’s have won six straight.

Pastrnak was too hot a topic to dismiss, though.

“He’s really become an elite player in the league,” said Marchand. “The fact that he’s able to continue to find ways to score when teams are really zoning in on him is very impressive. There are very few guys in the league who can do that.”

Pastrnak had actually gone a bit dry recently, with no goals in his previous four games and only one in his past seven. Great playmaking helped him break through.

Marchand turned a defensive play and a spectacular rush into Pastrnak’s first goal after 6:59. Marchand stole Jonathan Drouin’s short pass at the red line and raced into Canadiens territory against Jeff Petry, catching the defenseman a bit flat-footed. Marchand put the puck through Petry’s skates and picked it up on the other side as Brett Kulak approached from Marchand’s right, but Marchand slipped a pass through the pressure to Pastrnak, who fired into an almost unguarded net.

Pastrnak reached 40 at 4:16 of the second period, again off an outstanding pass. This one came from center Sean Kuraly, who took the puck from Petry a few feet inside the Bruins’ blue line and lugged it up the ice on a 2-on-1 rush. Kuraly got his pass through Xavier Oullet to Pastrnak, who held the puck until Carey Price went down and lifted in over him to make it 2-0.

The Habs answered only 26 seconds later, when Marco Scandella’s shot from the middle of the point hit the leg of Nick Suzuki and deflected past Rask at 4:52. A 4-on-3 power play later in the period gave the B’s a chance to go back ahead by two, and Pastrnak used it to make it 3-1 with 4:15 left in the second period. Petry was victimized again, this time putting a clearing attempt right on Pastrnak’s stick after Price saved Marchand’s one-timer; Pastrnak slid his shot beneath Price and just inside the far post.

Patrice Bergeron’s empty-net goal closed the scoring with 20 seconds remaining.