The 37-year-old Federer, playing at Roland Garros for the first time since 2015, saw off the 63rd-ranked Norwegian Casper Ruud 6-3, 6-1, 7-6 (10/8) on Court Suzanne Lenglen.
It is the 14th time the 20-time Grand Slam champion has reached the second week in Paris, and he will face Argentina's world number 68 Leonardo Mayer for a quarter-final spot.
"It was hard to find weaknesses in his game, so I'm relieved, I'm now going to have a good shower and it's going to be great," said the 2009 winner, who hit 52 winners and served 11 aces past Ruud, whose father Christian played the 1999 French Open when Federer made his debut.
Federer is the oldest man to book a last-16 place since Nicola Pietrangeli, a two-time champion, at the age of 38 in 1972.
The 20-year-old Ruud, who was ranked as low as 135 earlier in the season, started well, but Federer broke for a 4-3 lead with a sumptuous flicked backhand passing shot and wasted little time in finishing off the set.
Third seed Federer romped through the second set, hitting 17 winners, and then quickly recovered an early break in the third as Ruud started to find some rhythm.
The underdog did well to force a tie-break, saving two break points in game seven, but Federer moved through the gears in the breaker to take a 6-4 lead.
Ruud saved back-to-back match points to keep Federer waiting, though, but saw a set point come and go as the Swiss great successfully served and volleyed before finally completing the win on his fourth match point with an emphatic smash.
- Nadal sees off Goffin -
Reigning champion Nadal survived a blip to continue his bid for a record-extending 12th French Open title with a four-set win over David Goffin, ten years to the day since his shock 2009 exit to Robin Soderling.
The 17-time Grand Slam winner bounced back after an excellent third set from Belgian 27th seed Goffin to win 6-1, 6-3, 4-6, 6-3 and take his incredible Roland Garros win-loss record to 89-2 -- those two defeats coming against Soderling in the last 16 a decade ago and against Novak Djokovic in 2015.
Nadal maintained his record of never having lost in the first week in Paris, although he withdrew injured before the third round in 2016.
He powered 38 winners past Goffin on Court Philippe Chatrier to set up a fourth-round clash with Argentinian Juan Ignacio Londero.
"David is a very good player. I started the match at a good level," said Nadal. "After, in the third set, he played very well. I'm very happy to reach the last 16."
Later on Friday, play was stopped due to darkness with former champion Stan Wawrinka leading Grigor Dimitrov 7-6, (7/5), 7-6 (7/4), while Stefanos Tsitsipas and Filip Krajinovic played until 9:42 p.m. local time until the match was halted with the Greek star 7-5, 6-3, 5-5 ahead.
- Second seed Pliskova crashes out -
Pliskova exited the French Open in a blaze of unforced errors as she was comfortably dismissed 6-3, 6-3 by Croatia's Petra Martic.
The 31st-seeded Martic will face Estonia's Kaia Kanepi for a place in her first-ever Grand Slam quarter-final.
Pliskova's defeat means Naomi Osaka will retain the world number one spot after Roland Garros.
Pliskova was considered one of the favourites after winning the Italian Open in Rome, but said Roland Garros' premier Chatrier court did not play to her strengths.
"I think the court is pretty slow, so you just have to play some extra shots," said the former world number one, who is still yet to win a Grand Slam title.
Garbine Muguruza, the 2016 champion, made short work of Ukrainian Elina Svitolina, winning 6-3, 6-3, as the ninth seed's disappointing clay season ended on a low note.
Spanish 19th seed Muguruza reached the fourth round for the sixth successive year and set up a tie with last year's runner-up Sloane Stephens.
Johanna Konta became the first British woman to book a place in the second week in 36 years by thrashing Slovakia's Viktoria Kuzmova 6-2, 6-1.
Elsewhere in the men's draw, Japanese seventh seed Kei Nishikori edged out Serbia's Laslo Djere in an epic encounter 6-4, 6-7 (6/8), 6-3, 4-6, 8-6.