Halep saved three match points and missed three opportunities to serve out for victory, before finally tottering over the finish line by a 4-6, 6-4, 15-13 margin.
Halep, who turned her left ankle during her first match here, managed to dart around the court with the ankle taped tightly, but will likely be concerned as to how she will recover after this endurance test. "My ankle is, I don't know how it is because I don't feel it anymore!"
"I'm just trying to change myself to not think that much about the points", Halep said.
Davis showed her intent with a barnstorming first set, unleashing her powerful backhand to the delight of the Rod Laver Arena crowd.
South Korean Chung Hyeon does not appear especially intimidating behind his Zen-like demeanour and white-framed spectacles but as German wunderkind Alex Zverev will testify, the 21-year-old should come with a health warning.
The third was simply out of this world.
She served five aces in six attempts to open the match - four in the first game and another on the second point of her next service game.
"Definitely it was a very tough match", said Halep afterwards.
Each time, Davis jumped off the deck to break back, fist-pumping to an appreciative crowd.
She sealed the win on her first match point when 76th-ranked Davis fired a forehand into the tramlines, as the hard-hitting American coughed up a mind-boggling 73rd unforced error. She did everything possible to stay in the match, keeping long rallies alive to put pressure on Halep.
There are many similarities between Davis and Halep. The Romanian served for the match in the 10th game, 12th game, 16th game and then the 28th game.
The 26-year-old Halep will meet the victor of home favorite Ashleigh Barty and Japan's Naomi Osaka for a place in the quarterfinals, having carried her injured ankle through a deciding set of 142 minutes.
That's if she can walk.
"There's a lot of Voltaren and painkillers in her system". "I never played the third set so long". But she improved a lot, and I can say that she's a great athlete and also player.
Men's second seed Roger Federer had no such trouble, as he booked his spot in the fourth round with a 6-2, 7-5, 6-4 defeat of Richard Gasquet, while Novak Djokovic downed Albert Ramos Vinolas 6-2, 6-3, 6-3.
During Halep and Davis' deciding set, No 6 seed Karolina Pliskova had the time to start and comfortably finish a 7-6 7-5 win over Czech compatiriot Lucie Safarova. I had come to believe again, to restart the mind.
But it was an hour short of the 2011 Australian Open record set as Francesca Schiavone of Italy beat Russia's Svetlana Kuznetsova 6-4, 1-6, 16-14 in 4hr 44min. Her score against former top-10 player Andrea Petkovic of Germany in the second round was 4-6, 6-0, 6-0.
"I finished the US Open, and I was exhausted", Keys said.