Keshav Maharaj and George Linde took five wickets between them but Pakistan's lead reached 200 at stumps on day three in Rawalpindi.
Anrich Nortje took the third five-wicket haul of his Test career, but South Africa ended day two on the back foot again against Pakistan.
Pakistan lost three wickets for one run in the first session against South Africa but Babar Azam and Fawad Alam stopped the rot.
Pakistan triumphed in Karachi in the first Test as the Proteas saw their winless run continue, despite a valiant fightback.
Australia will not travel for a three-Test series against the Proteas, despite Cricket South Africa's best efforts.
A second wave and a new variant of COVID-19 in South Africa has led to Australia cancelling their three Tests against the Proteas.
Pakistan lost both openers early but managed to chase down a target of 88 to win the first Test by seven wickets.
South Africa fast bowler Kagiso Rabada revealed the hard work and dedication that went into reaching a major milestone.
Yasir Shah dazzled with bat and ball as Pakistan took a grip on the first Test against South Africa, helped by a string of late wickets.
Pakistan are on top after South Africa took only four wickets on day two of the first Test, Fawad Alam the star of the show.