In the quarter-final Stearns will face one of Danielle Collins, who knocked out reigning champion Iga Swiatek, or Elina Svitolina after coming through an attritional match which lasted two hours and 43 minutes on a baking centre court.
Osaka is another big name that American Stearns has beaten in Rome after also knocking out fifth seed Madison Keys in the previous round.
Former world number one Osaka has looked a long way from the player who has won four Grand Slams since returning last year from a 15-month break from tennis for the birth of her daughter.
Her comeback was also hampered by an abdominal injury that forced her out of the Australian Open, after which early exits at Indian Wells and Madrid highlighted how far she was from her best.
Osaka warmed up for Rome by winning a minor event in Saint Malo in France earlier this month.
But she has failed to get past the last 16 of a tournament higher than the WTA 125 series since losing the Auckland final back in January.