Duanne Olivier completed his third five-for of the series as Pakistan were skittled for 185 halfway through day two of the third Test at Wanderers.
After a circus of a first hour in the opening session that saw the Proteas squander six clear opportunities to take wickets, Duanne Olivier and Vernon Philander fought back to restrict Pakistan to 111-5 by lunch.
Pakistan picked themselves up after the break and for a while it looked positive for the visitors, as their skipper Sarfraz Ahmed reached his 18th Test half-century. He was removed by Kagiso Rabada two balls later, with Olivier picking up a quick double after his dismissal.
Olivier removed Babar for 49, followed by Faheem Ashraf for a duck as Pakistan collapsed to 169-8. Pakistan took their total to 185 before Olivier removed Mohammad Amir for 10 to take his third five-for in the series, Hamza taking a simple catch.
Kagiso Rabada (2-41) finished the visitors off as they were dismissed for 185.
South Africa 262 – Aiden Markram (90), Theunis de Bruyn (48); Faheem Ashraf (3-57), Mohammad Amir (2-36)
Pakistan 185 – Sarfraz Ahmed (50), Babar Azam (49), Imam-ul-Haq (43); Duanne Olivier (5-51), Vernon Philander (3-43)