Alex Newhook, Darren Helm, and Andre Burakovsky also scored, and Nazem Kadri and Erik Johnson each had two assists for the Avalanche (48-14-6), who are 7-1-1 in their past nine games. Pavel Francouz made 25 saves.
Colorado leads the Calgary Flames by 13 points for first place in the Western Conference.
"It was a great game from us since the start," Francouz said. "They evened it up a little bit in the second, and the third period was something I've never experienced before. We just played in their zone all the time, and they barely got some shots. So that was unreal."
Timo Meier and Brent Burns scored, and Kaapo Kahkonen made 42 saves for the Sharks (29-30-8), who were coming off a 5-2 loss at the Arizona Coyotes on Wednesday.
"I thought we played hard for being in a back-to-back situation," San Jose coach Bob Boughner said. "I thought there were a lot of good things with our game. That's one of, if not the best, teams in the league. There were things we needed to do better, face-offs and pouncing on some of our chances."
Rantanen made it 3-2 at 12:17 of the third with a power-play goal. He shot past the outstretched glove of Kahkonen after receiving a cross-ice pass from Kadri.
"Mikko, he got better as the game went on," Colorado coach Jared Bednar said. "I thought he had a little bit of a slow start to the game, but he comes up clutch on a big power-play goal. Great pass from 'Naz.' It was a little bit of a broken play, but they find a way to get it to the open man, and he made no mistake on it."