Kei Nishikori, runner-up in 2014, was also pleased to get through in three sets in blazing sunshine on Louis Armstrong Stadium.
Novak Djokovic on Monday reached the U.S. Open quarterfinals, beating Joao Sosa 6-3, 6-4, 6-3 to move into the final eight at Flushing Meadows for the 11th time.
As the temperatures rose so did the tempers, with both players engaging in animated arguments with chair umpire James Keothavong. It's the first time in Federer's career that he has lost to a man ranked outside the top 50 at Flushing Meadows. That was the first time in tournament history that the U.S. Open created an extreme heat policy for men's matches - players can opt for a 10-minute break between the third and fourth sets - similar to what's standard on the women's tour, when there can be a delay between the second and third sets. I've always done that in my career.
The biggest concern for Djokovic might well have been the conditions as the heat returned to NY after a few days of relief.
Things got tougher in the second as a sluggish Djokovic laboured before again clinching the set with a break.
Djokovic, however, was able to keep his cool just long enough to finish off Sousa with another late break.
But Millman's fighting qualities shone through again when he immediately broke back, as the fourth set went back on serve and proceeded to another tie-breaker, which he won 7-3.
But that only delayed the inevitable as Nishikori kept his focus to seal the win and extend his ideal record against the German to 3-0. 'I don't see his body giving up', O'Shannessy said about Federer on Love Tennis Podcast.
Roger Federer defeats Nick Kyrgios to reach US Open fourth round
When a reporter asked her if she remembered the last time she had double-bageled, she said, "Yes, it was you, in my dreams". Federer , who is seeded second at Flushing Meadows , admitted that it was one of the best shots of his career.
Madison Keys returned to the U.S. Open quarterfinals with a 6-1, 6-3 victory over No. 29 seed Dominika Cibulkova of Slovakia.
Federer wasted two set points in the 10th game, giving Millman a break chance when he missed an easy volley then double-faulting on break point.
Before this year's US Open, Millman had only ever progressed past the first round of a Grand Slam tournament on a handful of occasions, with his previous best efforts coming in third round exits at the 2016 Australian Open and 2016 Wimbledon.
But Millman is in the form of his life, having surged to the fourth round of a grand slam for the first time with a series of upsets - including that of 14th seed Fabio Fognini. Start with this: Federer held two set points while serving for the second at 5-4, 40-15 and did not pull through. Osaka had won 22 consecutive games leading into the match, but was tested by Sabalenka, who double-faulted on match point.
Instead, it'll be the 55th-ranked Millman, who had never made it past the third round at a Slam until last week, taking on No. 6 seed Djokovic. Until meeting Millman Tuesday, Federer hadn't dropped a set all tournament at the Arthur Ashe. "He was playing great, hitting the ball very, very strong", he said.
"I've got a lot of respect for Roger".