Colin Graf had a goal and two assists, John Klingberg had two assists, and Alex Nedeljkovic made 25 saves for San Jose (32-26-6), which won its second straight game and is 5-1-2 in its past eight.
Celebrini has seven goals and six assists during his streak.
Cole Caufield and Nick Suzuki scored, and Noah Dobson had two assists for Montreal (36-19-10), which had won three straight. Jakub Dobes made 17 saves.
Caufield, who missed Montreal’s 3-2 win at the Ottawa Senators on Wednesday with the flu, put the Canadiens up 1-0 at 7:21 of the first period. He took a cross-ice pass from Juraj Slafkovsky in the neutral zone and drove the left side before snapping a shot past Nedeljkovic’s glove from the left face-off dot for his career-high 38th goal.
Celebrini tied it 1-1 at 13:12. Graf rushed up the left side from his own zone before making a backhand pass to Celebrini, who scored on a wrist shot past Dobes stick side from the top of the left face-off circle.
Mario Ferraro put the Sharks up 2-1 at 11:56 of the second period when he scored on a wrist shot from the point through traffic that sailed over Dobes’ right shoulder.
Graf made it 3-1 at 16:20 after Celebrini’s shot from the point struck his leg in front of the net and went in glove side on Dobes.
Suzuki cut it to 3-2 at 17:38 when he took a drop pass from Slafkovsky and beat Nedeljkovic with a wrist shot from the top of the left face-off circle.
Celebrini scored into an empty net with 2:03 remaining for his 35th goal and 94th of the season, making it a 4-2 final.
Each team had an apparent goal waved off.Â
The referee’s whistle blew before Montreal’s Lane Hutson put the puck in at 2:56 of the first. Celebrini had a goal denied at 1:36 of the second after the Canadiens challenged for offside.