After winning Wimbledon a week ago, Federer returned to the top for the first time since June 2010. Monday marked his 287th week at No. 1, one more than Sampras.
The 17-time Grand Slam champion also tied Sampras' record of seven Wimbledon titles. Federer first becameNo. 1 in 2004 and said it was an "amazing feeling" to be back at the top.
"I had set a goal with my team to try and get back to the top of the rankings, but I never thought with the depth in the game this year that I would have been able to get it back so quickly," Federer said. "I am extremely proud and honoured to have beaten Pete's record as he was my childhood hero and I have always looked up to him."
The Swiss star will enter the Olympics next week as the world's top-ranked player following his four-set win over Briton Andy Murray in the final at Wimbledon, which also will host the Olympic tennis competition.
Federer spent 237 consecutive weeks at No. 1 between February 2004 and August 2008 and overtook Novak Djokovic atop the rankings with his win at Wimbledon — his 75th career ATP title.
"Great effort," said Sampras. "The hardest thing to do in sports is the ability to stay on top. Roger has been able to do so by great play and durability."