General manager Doug Wilson said earlier in the week that it would be a "home run" if he could lock up his two most important potential free agents this week, and he was able to deliver.
"They're the type of players just coming into their prime and elite level players," Wilson said. "I don't think there's any doubt and history has shown that the marketplace would have been very friendly and kind to these two players. Supply and demand. It's awfully rare that these type of players are available."
The moves to keep Marleau and Pavelski come two days after Wilson informed longtime goaltender Evgeni Nabokov that the team would not offer him a contract when he becomes a free agent.
Wilson said he couldn't afford to spend too much of the team's cap space on goaltending. He was able to use that money to help keep the two star forwards.
Marleau, who was eligible to be an unrestricted free agent on July 1, will receive $27.6 million in the four-year deal. Pavelski, who would have been a restricted free agent, will be paid $16 million.
Wilson praised the players for being willing to take contracts that will allow the Sharks to keep the core of this team together without hindering them in the future in terms of cap management.
Pavelski said he got a "fair deal" even though it's possible he could have made more if he waited until the start of free agency. He said Marleau's decision to stay shows the players have to make the necessary sacrifices to become a championship team.
Marleau and Pavelski helped lead San Jose to one of its most successful seasons in franchise history. The Sharks posted the top record in the Western Conference for the second straight year and beat Colorado and Detroit in the first two rounds of the playoffs.
San Jose fell short in its second appearance ever in the Western Conference final, getting swept by eventual Stanley Cup champion Chicago.
"We're coming into a wonderful time for this organization age wise where we probably have a four- or five-year window," Wilson said. "They want to be a part of it and it sent a strong message to their teammates and fans that this is where they wanted to be."
Marleau, the No. 2 overall pick in the 1997 draft, is first on the career list of almost every major offensive category for San Jose. He has goals (320), assists (373) and games played (953) than any player in franchise history.
Marleau, 30, is coming off his most productive season. He scored a team-leading 44 goals, the fourth most in the NHL, and finished with 83 points playing mostly on a line with fellow Canadian Olympians Thornton and Heatley.
Marleau had eight goals and five assists in the playoffs, scoring the game-winners in San Jose's final two wins over Detroit in the second round, and five goals in four games against Chicago in the conference final. Marleau's 34 playoff goals since the 2003-04 season are the third most in the NHL.
Pavelski, 25, emerged as one of the top young players in the league this season. He played well for Team USA at the Olympics, where he won a silver medal, and then had a breakthrough early in the postseason.
He had nine goals, eight assists and three game-winning goals in 15 games. He scored two goals in the first-round clincher against Colorado and two in each of the first two games of the second round against Detroit, becoming the first player since Mario Lemieux in 1992 to have three straight multigoal games in the postseason.
Pavelski tied his career high in the regular season with 25 goals despite missing 15 games early with a broken foot. He also finished fourth in the league in faceoff percentage, winning 58.1 percent of his draws.
"He's a three-zone player and on top of that he plays the point on the power play. He has so many skill sets that are important to winning," Wilson said. "He's a player that we knew and believed would get to this level. He's a crucial part of our hockey team."
The Sharks now will try to lock up some of their other unrestricted free agents, including forwards Manny Malhotra and Scott Nichol and defenseman Niclas Wallin. Wilson said progress is being made in those talks.
Information from ESPN.com's Pierre LeBrun and The Associated Press was used in this report.