Federer romped to a 6-4, 6-2, 6-2 win to hand the Swiss an unbeatable 3-1 lead after Stan Wawrinka had won the opening singles of the match and the world number two and four had teamed up to win the doubles on Saturday.
It was one of the greatest sporting triumphs for Switzerland, the 14th nation to win the Davis Cup, and a huge personal milestone for Federer to go with his 17 Grand Slam titles, six Masters titles and Olympic doubles gold.
It left him with just an Olympic singles gold to win in Rio in 2016 to become just the third man, after great rival Rafael Nadal and Andre Agassi, to win all four Grand Slam titles, the Olympic title and the Davis Cup.
"It's an an enormous pleasure for me, I've waited 15 years for this," Federer said.
"This has been a perfect weekend in a crazy atmosphere and all the Swiss fans helped us enormously. But he refused to accept that finally winning the Davis Cup made him the greatest player of all-time.
"That's of no importance to me, what matters is that I enjoy playing tennis," he added.
Fifth and final rubber cancelled
Organisers promptly announced that the scheduled fifth and final rubber opposing Gael Monfils and Wawrinka had been cancelled and that the final score was Switzerland 3 France 1.
Federer had expected to play Jo-Wilfried Tsonga in the first of Sunday's two rubbers, but the French number one, who lost to Wawrinka in four sets on Friday, was struggling with an arm injury and generally out of sorts.
In came Gasquet with the monumental task of defeating Federer and opening the door for the possibility of the in-form Monfils defeating Wawrinka in the decider.
Another world record crowd of 27,488 roared their support for Gasquet as the two players came out on to the red claycourt set down inside one half of a roofed over Lille football stadium.