Serena, Thiem move into US Open semi-finals
Williams, seeded third, came from a set down to overcome unseeded Bulgarian Tsvetana Pironkova and keep alive her bid for a 24th singles Grand Slam title at Flushing Meadows.
Later, Azarenka blew away Belgium's Elise Mertens as she continues her hunt for a first Grand Slam title in seven years.
Williams' comeback included two astonishing shots with her left hand that contributed to winning points.
"At that point I was fighting so hard. I was just trying to do everything I can whether righty or lefty," she said.
A sluggish start saw the American lose the first 6-4, but she fought back to take the next two 6-3, 6-2, in 2hr 12min inside Arthur Ashe Stadium.
"I never give up and you know I just gotta keep going," Williams added.
Williams smashed 20 aces, the most she has had in eight years, taking her tally for the tournament to 64 so far.
The record for the most number of aces in a US Open in the women's singles is 70, set by Williams in 1999 when she won for the first time.
"Sometimes when I'm serving, I just tell myself, I don't care if my arm falls off, I'm going to keep serving," she said.
Williams is looking to match Margaret Court's record for the most number of singles Grand Slam wins.
It has been more than three years since she won her 23rd at the 2017 Australian Open -- when she was already pregnant with daughter Olympia.
Williams has come close since, reaching four major finals only to come away empty handed.
In the last four she will renew her rivalry with former world number Azarenka who demolished Mertens 6-1, 6-0 in just 1hr 13 min.
Williams defeated Azarenka in the final of the US Open in 2012 and 2013.
- 'Happy' -
The last few years of Azarenka's career have been interrupted by a custody battle over her son who was born in 2016.
Azarenka said she found it "hard to accept losses" when she was young and at the top of her game, but was now benefiting from a more philosophical attitude.
"I enjoy the moment no matter what it is. I take life as it comes," Azarenka told reporters.
"It took me a long road to come here with a lot of struggles, a lot of understanding, forcing me to find this route, this path, if you can say that. But I'm here and I'm happy."
In the men's draw, Russia's third seed Medvedev downed compatriot and childhood friend Andrey Rublev 7-6 (8/6), 6-3, 7-6 (7/5).
Twenty-two-year-old Rublev raced to a 5-1 lead in the first-set tie-break before Medvedev, last year's US Open runner-up, hauled back to win it 8-6 with an ace.
Medvedev, 24, smashed 16 aces and won 89 percent of first-serve points. He made 75 percent of returns to Rublev's 54 percent.
"One point decided two sets so it was a really tough match and Andrey was playing unbelievable actually," Medvedev said.
Medvedev will play second seed Thiem who demolished Australia's Alex de Minaur, seeded 21st, 6-1, 6-2, 6-4.
"I had a great feeling from the first moment on," said the Austrian.
Fifth seed Alexander Zverev of Germany faces Spain's 20th seed Pablo Carreno Busta in the competition's other semi-final.
The disqualification of Novak Djokovic for accidentally hitting a line official with a ball during the last 16 means the US Open will crown a first-time Grand Slam winner on Sunday.