The 20-time Grand Slam title winner, who will be 40 in two months’ time, battled over three and a half hours until 12:45 Sunday morning to reach the last 16 in Paris.
He is due back on court on Monday to tackle Matteo Berrettini for a place in the quarter-finals.
However, having undergone two knee surgeries in 2020, the Swiss star admitted there are doubts he’ll make it.
“I don’t know if I am going to play,” said Federer who is likely to be playing his last French Open.
“I have to decide whether or not to continue. Is it too risky to keep putting pressure on the knee? Is it a good time to rest?
“Every match I have to reassess the situation and see the next morning in what state I wake up and how my knee is doing.
“It may be even more true after a match as long as the one tonight.”
If his knife-edge 7-6 (7/5), 6-7 (3/7), 7-6 (7/4), 7-5 win over 59th-ranked Dominik Koepfer was his last match in Paris, it will be remembered as a gripping affair on the court, but soulless off it.
Due to a government-imposed Covid-19 curfew, Court Philippe Chatrier was devoid of fans and atmosphere.
Federer is playing only his third tournament since last year’s Australian Open and has always said Wimbledon is his main goal.
He is chasing a ninth title at Wimbledon which starts on June 28.
3️⃣ hours and 3️⃣6️⃣ minutes!At 12:43 am, @rogerfederer slams the door on Koepfer 7-6(5), 6-7(3), 7-6(4), 7-5 to… https://t.co/rvWQ3GVhr3
— Roland-Garros (@rolandgarros) 1622933116000
He is also scheduled to play the warm-up grass court tournament in Halle beginning on June 14, the day after the French Open ends.
Federer, who made his Roland Garros debut in 1999 and was champion in 2009, was playing a night session for the first time.
However, the almost empty 15,000-capacity court was eerily silent.
“I might have been more nervous if the stadium had been full,” added Federer.
“All the matches I’ve played since the injury are information for the rest of the season.
“It gives me real pleasure to be able to play 3hr 30min at a high level against a very good player. It shows that I’m on the right track.”
As Federer weighs up leaving a tournament where Rafael Nadal and Novak Djokovic were always the title favourites, fellow veteran Serena Williams resumes her bid for a historic 24th Grand Slam title.
Seeded seventh, the 39-year-old Williams is the second-highest ranked player left in the women’s draw.
After Naomi Osaka’s shock withdrawal, Simona Halep missing the event through injury and early losses for Bianca Andreescu and Angelique Kerber, none of the players who have beaten Williams in Grand Slam finals since her last title at the 2017 Australian Open are still in the competition.
The former world number one, still just one short of Margaret Court’s all-time record of major trophies, takes on Kazakhstan’s Elena Rybakina for a spot in the quarter-finals.
Williams has not gone beyond the fourth round in Paris since losing the 2016 final to Garbine Muguruza.
She arrived at this year’s French Open with just one win on clay this term.
“I’ve had a rough clay court season thus far, so I’m happy to get some wins on the clay,” Williams said after beating fellow American Danielle Collins in round three.
Tamara Zidansek on Sunday became the first Slovenian woman to reach the quarter-finals of a Grand Slam when she defeated Romania’s Sorana Cirstea 7-6 (7/4), 6-1.
The world number 85, who knocked out former US Open champion Andreescu in round one, will face either 2019 Roland Garros runner-up Marketa Vondrousova or Paula Badosa for a place in the semi-finals.
The 23-year-old had never previously got beyond the second round of a major.
Greek star Stefanos Tsitsipas is seen as a favourite to reach his first Grand Slam final, with Nadal, Djokovic and Federer all in the other half of the men’s draw.
A semi-finalist at the past two majors, Tsitsipas was beaten in a thrilling five-setter by Djokovic in Paris eight months ago.
On Sunday, he faces 12th seed Pablo Carreno Busta.
He could then meet twice Grand Slam finalist and second seed Daniil Medvedev, the Russian who plays Chile’s Cristian Garin in the last 16.