Djokovic and Philipp Kohlschreiber resumed their third-round match that was suspended because of rain a night earlier. The unseeded German knocked off the five-time tournament champion 6-4, 6-4.
Osaka lost to Belinda Bencic 3-6, 1-6 in just over an hour in the fourth round of the first title defense of her career.
The bottom half of the men's draw still includes No. 2 seed Rafael Nadal and fourth-seeded Roger Federer, both of whom breezed to victory. Nadal eased by 25th-seeded Diego Schwartzman 6-3, 6-1, while Federer defeated Swiss countryman Stan Wawrinka 6-3, 6-4.
"I liked my chances more at night against Kohlschreiber, but it wasn't to be last night. Completely different conditions today. I congratulate him for playing tactically really well and getting me out of my comfort zone. He deserved to win," Djokovic said.
The 35-year-old German started thinking he had a chance early in the first set when he survived a handful of break points on his serve.
"I would say after 3-all in the first set I felt like getting closer to the set, holding my service games, which is not easy against Novak, because he’s such a great returner. I know from that point on it's gonna be a very interesting match."
Also ousted from the men's event were No. 6 Kei Nishikori, No. 10 Marin Cilic and No. 14 Daniil Medvedev.
In women's fourth-round matches, No. 2 Simona Halep lost to Marketa Vondrousova 2-6, 6-3, 2-6 and No. 7 Kiki Bertens was beaten by 20th-seeded Garbine Muguruza 7-5, 1-6, 4-6.
Venus Williams reached the quarterfinals with a 6-4, 6-4 win over Mona Barthel.