MONTREAL -- The Montreal Canadiens shot their way out of their longest losing streak in almost two years.
Brian Flynn and Max Pacioretty scored when Montreal tied a team record for shots in one period on its way to a 3-1 win against the Ottawa Senators at Bell Centre on Saturday.
Jeff Petry scored in the second period to make it 3-0. The Canadiens (20-8-3), who ended a four-game losing streak, outshot Ottawa 42-26.
It was Montreal's longest losing streak since going 0-4-0 from Jan. 18-25, 2014.
"I saw a quote; it said, 'To win, you have to know how to lose,' and I really like that because we learned a lot from those four games," Pacioretty said. "We showed it [Saturday]. Obviously, it's not perfect, and a couple of times in the second [period], getting hemmed in, but build on that and we move forward from this game on."
The Canadiens' 27 shots on goal in the first period tied their record set in the first period of a 6-3 win against the Philadelphia Flyers on Jan. 20, 1973, and second period of a 3-3 tie at the Los Angeles Kings on Feb. 5, 1977.
The NHL record for shots in one period is 33, set by the Boston Bruins in the second period of a 3-2 win against the Chicago Blackhawks on March 4, 1941.
"We've had some good starts during the year but obviously that was probably our best period," Montreal center Tomas Plekanec said. "We played the way we wanted to, put a lot of shots and got a two-goal lead, which was important for the rest of the game, which we didn't get the previous game."
Dustin Tokarski made 25 saves in his second straight start for the Canadiens, who scored two goals or fewer while going 1-4-1 in their previous six games.
"It's always good to get a win for this team, and the guys played outstanding tonight," said Tokarski, who got his first win since March 17.
"Shock," was Ottawa coach Dave Cameron's reaction to the Senators' start.
"I have no idea what happened in the first period," Cameron said.
Senators goalie Craig Anderson made 28 saves on 31 shots, including 25 saves in the first. He allowed Petry's goal on Montreal's 29th shot at 5:39 of the second.
Anderson, who made his 14th consecutive start, was replaced by Chris Driedger after the Canadiens appeared to have scored a fourth goal at 6:25. The goal was disallowed after a video review determined Pacioretty used his hand to bat the puck past Anderson into the net.
"Considering the situation and the body language that I was giving off and the frame of mind we all were in, I think it was the right play to get a jump start by changing the goalie," Anderson said.
Driedger made 11 saves in his first game since he was recalled from Binghamton of the American Hockey League on Nov. 23. It was his second NHL game; he played one last season.
Jean-Gabriel Pageau scored at 11:24 of the second for Ottawa (15-10-5), which ended a 1-3-0 road trip.
"We tried to pick it up after, and I think we battled pretty hard until the end," Pageau said.
Montreal defenseman Nathan Beaulieu returned after he was a healthy scratch for the Canadiens' 3-2 loss at the Detroit Red Wings on Thursday.
"I think that he was the best player on the ice," Pacioretty said.
Beaulieu assisted on Montreal's first goal at 2:48 when he drove behind the Senators net and put a shot off Anderson's pad. Flynn was open on the left side of the goalmouth to put in the rebound for his fourth goal.
Canadiens left wing Charles Hudon, who had an assist in his NHL debut Thursday, got the secondary assist.
Plekanec was reunited with Pacioretty, who he set up for Montreal's second goal off a turnover inside the Ottawa blue line. Plekanec got his 20th assist with a pass to Pacioretty, who beat Anderson from the right faceoff circle on the Canadiens' 26th shot with 33 seconds remaining.
"We need our best players to make a difference and win games," Montreal coach Michel Therrien said. "Some of them had good scoring chances but were unable to score. Putting Plekanec and Pacioretty back together was a message that was well received by the players."
Dale Weise, who assisted on Pacioretty's goal, took the Canadiens' record-tying 27th shot with one second left in the period.
Weise got his second assist of the game when Petry scored his fourth goal to finish off a passing play on an odd-man rush.
"Everyone was on the same boat tonight," Beaulieu said. "We knew this was a big game for us tonight and it was nice to see 20 guys pulling the same way, and a big win for [Tokarski] too. It was nice to see him play so well and it's not an easy situation for him."
Pageau drew Ottawa within 3-1 with his eighth goal on a rebound of Alex Chiasson's shot from the slot.
"It was a good shot from Chiasson, on net, and I was just there," said Pageau, who was scored three of the Senators' four goals in three games against Montreal. "It could have been anyone, I think, and unfortunately we lost, so that goal doesn't count."