Tomas Hertl, Matt Nieto, Timo Meier, Logan Couture, and Noah Gregor scored for the Sharks, who improved to 2-7-3 at home. Kaapo Kahkonen made 37 saves for his second win, and defenseman Matt Benning added two assists.
"Just really proud of our guys," Sharks coach David Quinn said. "That was a great bounce-back win. I thought we got better and better as the game went on."
Tim Stützle scored for Ottawa, assisted by Brady Tkachuk.
Gregor hit the post on a breakaway but scored shortly afterward to give the Sharks the lead with his first goal of the season.
"I have a little weight off my back," he said. "Sort of a frustrating start for me, so it was really nice to see that one go in."
Stützle scored his seventh to tie it at 1 in the first period. Tkachuk made a nice pass from behind the net to create the opportunity.
"We played really good in the first period, and then we needed to expect that they were going to push back," Senators defenseman Nick Holden said. "I mean, all teams are all going to push back on you, so you need to be able to play inside of that as well and weather it a little bit and then get back on them."
Meier put the Sharks ahead 2-1 just 1:18 into the second after a sweet feed from Karlsson. Meier extended his point streak to four games by scoring his ninth goal.
Nieto scored his fourth on a tip-in to make it 3-1 after Matt Benning flung a puck toward the net. It was Nieto's third goal in his last four games.
"There is lots of game left. There's no time to feel sorry for yourself," Senators coach D.J. Smith said. "You've got to pick it up. We tried, but it was just not our night."
Hertl scored a power-play goal with 4:04 left in the second. The Sharks held the puck in the offensive zone for the entire power play, and Hertl got his fifth of the season.
"The last 40 minutes, I think we played like the better team, and it was a nice win for us to get at home," Karlsson said. "It's been a while."
Couture sent one the length of the ice for an empty-net goal with 58 seconds left. It was his 10th goal of the season.
"We shut it down really well in the third. I think we did a great job there, not giving them anything," Kahkonen said. "It's tough if you give teams life early in the third because they might get a goal or something."
Senators: Visit the Vegas Golden Knights on Wednesday.
Sharks: Take on the Kraken in Seattle on Wednesday.