WATCH the WTA Tour LIVE on beIN SPORTS | via Foxtel, Kayo, Fetch & beIN SPORTS CONNECT
Potapova won the first set in 39 minutes, claiming the only break of the frame in the sixth game, but Pegula responded by breaking immediately in the second.
Despite squaring the match up, the American trailed 3-1 in the third set, only to fight back again and triumph in two hours and 17 minutes.
Pegula will face 15th seed Petra Kvitova after she won a seesawing three-set contest over 24th seed Jelena Ostapenko, 0-6 6-0 6-4.
Ostapenko won the first six games, before Kvitova won the next 10, only for the Latvian to hit back and claim the next four, squaring up the deciding set at 4-4. But two-time Wimbledon champion Kvitova held her nerve and won the final two games for victory.
World number two Aryna Sabalenka progressed to the final 16 via walkover after her third-round opponent Lesia Tsurenko withdrew.
The 2023 Australian Open champion will take on 2021 French Open winner Barbora Krejcikova after she toppled Wang Xin 6-2 6-7 (1-7) 6-2.
Seventh seed Maria Sakkari secured victory in a two-and-a-half-hour third-round clash with Anhelina Kalinina, winning 3-6 6-2 6-4.
Two-time major runner-up Karolina Pliskova won 6-1 7-5 over Veronika Kudermetova, progressing into the last eight to face Sakkari.
Sixth seed Coco Gauff, who turns 19 on Monday, eased past 54th-ranked fellow teenager Linda Noskova 6-4 6-3 in one hour and 19 minutes.
Sweden's Rebecca Peterson continued her resurgent form with a 3-6 6-3 6-1 win over Jil Teichman, setting up a clash with Gauff.