Alexander Wennberg had two assists, and Yaroslav Askarov made 38 saves for the Sharks (19-17-3), who have won two in a row.
Troy Terry had two goals and an assist, Cutter Gauthier had a goal and an assist, and Pavel Mintyukov also scored for the Ducks (21-16-2), who have lost three in a row and are 1-4-1 in their past six games.
Lukas Dostal allowed four goals on nine shots before being replaced in the second period by Petr Mrazek, who made three saves in relief.
"I don't know if lazy is the word, but we hadn't been skating as much as we were at the beginning of the season, so I thought we were doing that tonight, creating a lot of chances," Terry said. "That's just the way it goes sometimes. We can't feel sorry for ourselves, we've got to get this thing going again."
Mario Ferraro gave San Jose a 1-0 lead at 10:43 of the first period. Wennberg spun away from Anaheim defenseman Drew Helleson along the wall and centered the puck to Ferraro, who had beaten Mikael Granlund down the ice. Ferraro then redirected the puck into the net for his 100th NHL point.
Terry tied it tie it 1-1 at 15:02. Askarov was indecisive with the puck behind his net, and Ducks forward Nikita Nesterenko stole it from him before getting it out front to Terry, who slid the puck into an open net.
"It felt like, especially when we tied it, it felt like we were in control of that game and dictating the pace," Terry said.
Celebrini put San Jose back ahead 2-1 at 19:12. Wennberg floated a saucer pass to Celebrini in the slot, where he beat Dostal with a snap shot short side.
Igor Chernyshov, who scored his first NHL goal in a 6-3 win at the Vancouver Canucks on Saturday, scored again to make it 3-1 at 6:30 of the second period. He received a pass in front of Anaheim's net following a turnover, pulled the puck to his backhand, and scored from in close.
"You can call them grade A," Anaheim coach Joel Quenneville said of San Jose's scoring chances off turnovers. "I think we needed one or two of those prevented."