The Proteas struck back with four important wickets during the morning session on day two of the second Test against Pakistan.
After rain brought an early end to play on Thursday, the hosts resumed on 145-3 in Rawalpindi.
Anrich Nortje made the valuable breakthrough early on by dismissing Pakistan captain Babar Azam for 77, who was caught in the slips by Faf du Plessis.
Temba Bavuma then produced a moment of brilliance by running out Fawad Alam with a direct hit. Alam departed for 45 as Pakistan fell to 149-5.
Mohammad Rizwan and Faheem Ashraf shared in a 41-run partnership before the former was caught on the boundary by Kagiso Rabada, trying to hook a Anrich Nortje delivery.
Ashraf kicked with Hasan Ali at the other end but Ali was undone by Keshav Maharaj, who found the edge of his bat; Dean Elgar taking a sharp catch at slip.
Ashraf brought up his half-century as Pakistan reached the lunch break on 229-7.