Playing in a US Open main draw for just the second time in her career, Sun went out to a 5-2 lead in the first set before being broken for the first time in the match. But she held her composure to take out the set 6-4.
Twenty-three-year-old Osorio came out firing in the second set, going out to a 4-0 before eventually winning 6-2.
But Sun returned the favour with a fast start in the deciding set, herself going out to a 4-0. Osorio rolled her ankle in the final point of the fourth game needing a medical timeout. She returned to the court but wasn’t moving as freely as the Kiwi closed out the victory in an hour and 34 minutes.
Last year Sun was forced to retire from her first-round match in her maiden appearance at Flushing Meadows.
Sun, who was ranked as high as 39 in the world just over a year ago, dropped 62 places in the most recent world rankings after losing the points she earned from reaching the Monterrey Open last year, when she was knocked out at the round of 32 last week.
She earns US$154,000 ($265,153) for reaching the second round where she will meet either 19th seed Elise Mehrtens or American Alyssa Ahn.
Sun will look to win back-to-back main draw matches in a WTA event for just the second time this season.