Pacer claimed five wickets for the second time in the match as the Proteas now need just 149 runs to go 1-0 up in the three-match series.
Left-hander Shan Masoon finished the innings with the top score of 65 off 120 balls with the help of seven fours and one six. \
The Men in Green lost last nine wickets for just 89 runs in the final session of the play on the day after resuming their second innings at the score of 100 for one.
Opener Imamul Haq struck a brisk unbeaten half-century as Pakistan registered a solid start in their second innings to seize the initiative at tea on day two.
Pakistan built a lead of 58 with nine wickets remaining as the Test continued to move forward at pace after the tourists had bowled out their hosts for 223 on the stroke of lunch.
Imam (57) and Masood put on a valuable unbroken second wicket stand of 56 on a wicket already producing variable bounce on the second day.
The only wicket to fall in Pakistan's second innings in the second session was that of Fakhar Zaman, who matched his first innings score of 12 before flicking a Olivier delivery to Kagiso Rabada at fine leg.
South Africa were frustrated by a number of edges that fell short of the slip cordon, while Hashim Amla spilled a chance off Imam when he was on 15.
Earlier, pacers Mohammad Amir and Shaheen Afridi took four wickets each as Pakistan kept South Africa in check by restricting their first innings total to 223.
Amir (4-62) and Afridi (4-64) were particularly impressive in getting the ball to move off the pitch, with seven of their eight scalps being caught behind the wicket.
The home side resumed their first innings on 127 for five and looked to take the attack to the visitors early on the second morning, but lost nightwatchman Dale Steyn (23) when he edged Amir to wicketkeeper Sarfraz Ahmed.
Temba Bavuma moved to 53 with some excellent cover drives and intelligent placement, but his stay was ended when the excellent Afridi induced an edge to Ahmed.
Keshav Maharaj (4) was trapped leg before wicket by Hasan Ali (2-70) before a quickfire 19 from Rabada was ended when he attempted a drive off Afridi and was caught at second slip by Asad Shafiq.
Quinton de Kock (45) looked for quick runs to push the lead past 50, but was deceived by a slower ball from Amir and caught at cover by Fakhar.
COMMENTS (1)
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ