Context: 2019: Record third Hopman Cup, 100th title, 1200th match win and 12th Wimbledon final
Main article: 2019 Roger Federer tennis season
Federer opened his campaign by retaining the Hopman Cup alongside Belinda Bencic, becoming the first player to win the mixed-gender event three times.[245]

Federer was seeded third at the 2019 Australian Open, entering as the two-time defending champion. He defeated Denis Istomin, Dan Evans, and Taylor Fritz to reach the fourth round, where he faced 14th seed Stefanos Tsitsipas. In a stunning upset, Tsitsipas defeated Federer in four close sets. Critically, Federer was unable to convert any of the twelve break points he held throughout the match, including four set points in the second set. After the match Federer announced he would play the clay court season for the first time since 2016.[246][247]

At the Dubai Tennis Championships Federer won his 100th Career Singles Title, beating Tsitsipas in straight sets in the final. It was his eighth title in Dubai and he became only the second man after Jimmy Connors to reach the three figure mark in the Open Era.[248] Federer then reached the final of the 2019 Indian Wells Masters where he lost to Dominic Thiem in three sets.[249] On 31 March, Federer defeated John Isner at the 2019 Miami Open in straights sets to win his 4th Miami Open title and 28th Masters title.[250] Federer then played his first clay court tournament in three years at the 2019 Madrid Open and secured his 1200th career win, beating Gaël Monfils in the third round. In the quarterfinals he lost to Dominic Thiem again in three sets, despite having two match points in the second set.[251] Federer then played at the Italian Open and reached the quarterfinals but was forced to withdraw from his quarterfinal match against Stefanos Tsitsipas due to a right leg injury.[252]

Federer next played at the French Open for the first time in 4 years and seeded 3rd in the draw. Federer achieved comfortable straight-set victories against Lorenzo Sonego, Oscar Otte, Casper Ruud and Leonardo Mayer to reach the quarterfinals, where he faced good friend and compatriot Stan Wawrinka. Federer managed to avenge his loss to Wawrinka at the same stage of the tournament 4 years ago, winning in 4 sets after 3 hours and 35 minutes. With the victory Federer returned to the semifinals of the French Open for the first time since 2012, where he lost to defending and 11-time champion Rafael Nadal in straight sets.[253]

Federer then began his grass court season at the Halle Open where he won his tenth title at the event, defeating David Goffin in the final in straight sets. This marked the first time Federer had won a singles tournament ten times or more.[254] At Wimbledon, Roger Federer reached his record 12th final at the tournament after ousting his nemesis Rafael Nadal in four sets in the semifinal; thus, exacting revenge for his earlier defeat to him at the French Open. This was also the first time Federer played Nadal at Wimbledon since the 2008 Wimbledon final, a match regarded by some as the greatest match in the history of tennis.[255] Federer then faced Novak Djokovic in the final, against whom he lost in a five set thriller lasting 4 hours and 57 minutes, despite having two championship points on serve in the fifth set. The match also marked the first time a fifth set tiebreaker was played at 12 games all in the men's singles and was the longest men's final in Wimbledon history.[256]

Federer next played at the 2019 Cincinnati Masters and reached the third round where he lost in straight sets to Andrey Rublev. This was his quickest defeat in 16 years, taking just 62 minutes.[257] At the 2019 US Open, he was seeded third. He dropped the first set against both Sumit Nagal and Damir Džumhur in the first two rounds, but pulled out convincing straight sets wins over Dan Evans and David Goffin in the third and fourth. In the quarterfinals, he faced Grigor Dimitrov, who was ranked No. 78 going into the tournament. Despite taking a two sets to one lead, Federer ultimately lost the match in five sets.[258][259] At the 2019 Shanghai Masters, Federer defeated David Goffin in straight sets to reach the quarterfinals.[260] However, he lost the quarterfinal to Alexander Zverev in three sets.[261]

Federer advanced to the Swiss Indoors as the two-time defending champion. His first round match, against Peter Gojowczyk, was remarkable for being the 1500th match of his career. In the final, he defeated Alex de Minaur in straight sets for a record-extending tenth Swiss Indoors title.[262] Federer then played in the Björn Borg group at the 2019 ATP Finals where in the round robin, he lost his opening match to Dominic Thiem in straight sets but beat Matteo Berrettini and Djokovic (his first win over Djokovic since 2015) in straight sets to qualify for the semifinals.[263] He then lost the semifinal to Stefanos Tsitsipas in straight sets.[264]

2020: Australian Open semifinals and right knee surgery
Federer began his 2020 season at the 2020 Australian Open. He reached the semifinals after straight sets wins over Steve Johnson and Filip Krajinović, a five-set win over John Millman and a four-set win over Márton Fucsovics. Federer saved seven match points in his five-set quarterfinal win over Tennys Sandgren.[265] Federer then lost his semifinal match to Djokovic in straight sets, having sustained a groin injury earlier in the tournament.[266] In February, Federer underwent arthroscopic surgery for a right knee injury and subsequently withdrew from the Dubai Championships, Indian Wells, Miami Open, and the French Open to give time for his knee to recover, announcing that he would return in the grass season.[267] On 10 June, due to a setback from his initial rehabilitation from the knee injury suffered earlier in the year, Federer announced that he had to have an additional arthroscopic procedure on his right knee. He officially shut down his season to take the necessary time to recover, vowing to return in 2021. This was only the second year in Federer's career since he won his first title that he finished without a title.[268]

2021: Wimbledon quarterfinal and last singles match, injuries
In January, Federer withdrew from the 2021 Australian Open due to still recovering from knee surgery and strict COVID-19 quarantine measures in Australia.[269][270] On 8 March, Novak Djokovic surpassed him for the most career weeks spent as the ATP number 1 ranked player.[271] On 10 March, he made his return to the ATP Tour at the Qatar Open. He won his first ATP match in 14 months against Dan Evans, but lost to Nikoloz Basilashvili in the quarterfinals.[272]

Federer then played at the Geneva Open where he lost his opening match to Pablo Andújar in three sets.[273] After defeating Dominik Koepfer of Germany in four sets in the third round, Federer advanced to the fourth round at the French Open. However, he withdrew from the tournament before his fourth-round match citing knee problems, giving a walkover to Matteo Berrettini of Italy.[274]

In 2021 Halle Open where he was seeded fifth, he lost in the second round to Félix Auger-Aliassime. Federer was playing against the 20-year-old for the first time. Their 19-year age difference was the biggest in Federer's 1,521 career matches. This was the earliest exit at this tournament for Federer who was seeking his 70th match win in Halle, and his 18th quarterfinal at this event in as many appearances.[275][276] At Wimbledon, 39-year-old Federer advanced to the quarterfinals and thus became the oldest Wimbledon quarterfinalist in the Open Era, breaking the record held by Ken Rosewall,[277] following wins over Adrian Mannarino by retirement, Richard Gasquet, 29th seed Cameron Norrie, and 23rd seed Lorenzo Sonego. However, he was then upset by 14th seed Hubert Hurkacz in the quarterfinal in straight sets. This was the first time in 19 years at Wimbledon he had lost in straight sets, and only the second time he had lost a set 6–0 in the 21st century (the previous occasion was against Nadal in the 2008 French Open final).[278][279][280]

On 15 August, Federer announced that he underwent another knee surgery after further injury during the grass court season. He withdrew from the US Open and stated that he would be off the tour for "many months," but he hoped to make a return to the tour in 2022.[281]

2022: Retirement and farewell alongside rivals
Federer did not play after Wimbledon 2021, and dropped out of the top 50 on 13 June 2022. On 11 July 2022, he became unranked for the first time since his professional debut.[282][283]

However, Federer announced that he was set to return to the tour at the 2022 Laver Cup in September.[284] On 15 September 2022, he announced his impending retirement from professional tennis on the ATP Tour, noting that the Laver Cup would be his final ATP event.[285] He stated that he "will play more tennis in the future, of course, but just not in Grand Slams or on the tour."[286] His final match resulted in a loss in doubles partnering long-time rival and friend Rafael Nadal, against Jack Sock and Frances Tiafoe. The match was his 1750th on the tour.[287]
Question: Which was the longest Wimbledon men's final?
Answer: The 2019 men's final was the longest final in Wimbledon's history, lasting 4 hours and 57 minutes. Roger Federer faced Novak Djokovic in this match and lost to him in five sets.