The 20-times Grand Slam champion made an extraordinary 82 unforced errors to go with 62 winners as he went toe-to-toe with the world number 47 over more than four hours on Rod Laver Arena to secure his 100th Australian Open victory, Reuters reported.
Millman, who got the better of the Swiss at the 2018 US Open, had all the early momentum and won the opening set before Federer grabbed the second on a tiebreak and the third with a late break of serve.
The tireless Australian was never going to fold, however, and took the fourth set before forcing the third seed to battle back from a break down to seal the victory in the tiebreak.
"What a match. John deserves way more than half of this. He made it so difficult for me," said Federer afterward.
"He was doing all that stuff and kept on coming up with the goods. He deserves all the support – he is a great story and a great fighter."
Djoko marching through
Defending champion Novak Djokovic took only 85 minutes to defeat Yoshihito Nishioka 6-3, 6-2, 6-2 and reach the fourth round.
The second seed was ruthless with his serving and also efficient, breaking the Japanese world number 71 five times from six opportunities, BBC Sport reported.
"This was one of my best serving matches," said the Serb.
Djokovic also paid tribute to former Wimbledon champion Goran Ivanisevic, part of his coaching setup since last year, for helping improve his action.
"Obviously there are a lot of technical details you can talk about – although sometimes less is more," he added. "It's all about the rhythm and balance, to find the contact point on the serve."
Not giving up
Serena Williams will not give up on her chase for a record-equaling 24th Grand Slam title and believes she can still do it, despite crashing out of the Australian Open.
The 38-year-old American legend has lost four Slam finals since then, but this time did not get close, dumped out in the third round by China's 27th seed Wang Qiang, AFP reported.
Williams, who was downbeat but not broken, said she will be back on the practice court on Saturday.
"I just made far too many errors to be a professional athlete today," she said.
"I definitely do believe or I wouldn't be on tour," added Williams when asked if she thinks she can still reach Australian Margaret Court's 24 Slams record.
"I don't play just to have fun. To lose is really not fun."
Williams dropped just one game in beating Wang in the quarter-finals at the US Open last year, but was stunned 6-4, 6-7 (2/7), 7-5 on Friday.
Williams stressed that defeat was "not the end of the world", but admitted that she was angry and hurting inside as much as any defeat in her long and glorious career.
"I am just a better actress, as I always say now," she said.
"I'm no happier than I was 10 years ago, but I just have to pretend like I don't want to punch the wall, but in reality, I do."
Elsewhere, American teenager Coco Gauff stunned defending champion Naomi Osaka in straight sets to reach the fourth round.
The 15-year-old excelled at the Rod Laver Arena and eased to a 6-3, 6-4 victory in 67 minutes, BBC Sport reported.
"I don't know where that came from," the American said after the match. "Honestly, like, what is my life?"
"Two years ago I lost in the first round in juniors and now I'm here," Gauff added.
"I was telling myself one point at a time and keep fighting. You never know what happens on this court."
It was an uncharacteristically slow start for Japan's Osaka who had won the pair's only previous meeting at last year's US Open.
Gauff, who becomes the first 15-year-old to reach the last 16 of two Grand Slams since Martina Hingis in 1996, is set to break into the world's top 50 with her first win against a top-five player.
"Sometimes I get overwhelmed and I don't know what to do in these situations,” Osaka said.
"I have an age problem – I don't like losing to people younger than me. So I took this very personally."