Croatian Donna Vekic also progressed.
In the men's section, Spaniard Rafael Nadal dumped Marin Cilic in the round of 16.
Notably, promising German youngster Alexander Zverev was stunned by Diego Schwartzman.
Here are all the key results.
Bencic enjoyed a thrilling 7-5, 6-4 triumph over Osaka.
21-year-old Japanese star Osaka's loss means that she will fall from atop the WTA rankings next week.
"The challenge cannot be bigger against Naomi," Bencic said. "I had to be at the top of my game and I'm really pleased how well I handled my nerves at the end."
Osaka has shifted her focus at the 2020 Australian Open. "I can look at this and be very disappointed and mad, but I'm not mad about it," Osaka said. "I'd like to reach higher rounds. That's definitely what I'll aim for in Australia."
Osaka's exit means that the women's singles will see four different Grand Slam winners for the third consecutive year. This is an Open era record.
Joining Bencic was Vekic, the 23rd seed, who beat German 26th seed Julia Goerges 6-7 (5/7), 7-5, 6-3.
Meanwhile, Elise Mertens beat Kristie Ahn 6-1, 6-1 to set up a quarters clash against Bianca Andreescu.
Nadal overpowered Cilic 6-3, 3-6, 6-1, 6-2.
He will be up against Argentine 20th seed Diego Schwartzman in the last eight.
"The emotions I have when I play here are impossible to describe. I love the sport and feel very lucky to still be playing tennis here. Eight years ago I didn't think that would happen as my body was suffering badly," Nadal said.
Germany's Zverev rolled through the opening set against Schwartzman under the roof on Arthur Ashe Stadium.
However, he was stunned to lose the tie 3-6, 6-2, 6-4, 6-3.
"Generally my season so far has not been the best," said Zverev.
Italian Matteo Berrettini saw off Andrey Rublev to win the clash 6-1, 6-4, 7-6 (8/6).
Gael Monfils beat Pablo Andujar 6-1, 6-2, 6-2.
Love Sports news?
Subscribe to stay updated.