Latvia’s Sevastova, the 16th seed, won 5-7 6-4 6-2 to reach the quarter-finals in New York on Sunday, BBC reported.
The 27-year-old will play Sloane Stephens in the quarter-finals, after the American beat Julia Goerges.
Sharapova, ranked 146th after returning from a doping ban in April, was given a wildcard into the main draw.
“It’s been a really great ride in the last week,” said the 30-year-old.
“I can take a lot from this week. It’s great to get that major out of the way. It was an incredible opportunity. I’m very thankful for the opportunity.
“I did my best. I can be proud of that.”
The 2006 champion had played just one match since May coming into Flushing Meadows, with injuries forcing her out of the grass-court season and US Open build-up.
She played superbly to upset world number two Simona Halep on the first day of the tournament, and then beat Timea Babos and Sofia Kenin on her way to the last 16.
Sharapova’s presence in the main draw divided opinion from the moment her wildcard was announced, but she was unperturbed as she racked up three wins in a row for the first time since her comeback in April.
The Russian was warmly received by spectators and organisers were happy to draw on her star power, putting her on the main Arthur Ashe Stadium for all four of her matches.
That decision was described as “questionable” by fifth seed Caroline Wozniacki, but Sharapova simply responded that scheduling was not her responsibility.
Asked after Sunday’s defeat if she felt as though she had a target on her back, Sharapova responded: “I feel like I’m really beyond that. I mean, there’s no other way to explain it.
“I think there’s only a way to show it on the court, because that’s what really matters to me.
“I have so many things in my life that I’ve already been able to experience, but there’s a desire to keep going for more, and to keep training and to keep living through these moments out on these courts.
“That’s special and that’s meaningful. As long as I have that desire, I’ll be there. That’s what’s important to me.”