Left-arm spinner Paul Harris took three for 46 to help South Africa turn the screw on the fourth day of the first Test against Pakistan in Centurion on Sunday.
Pakistan were 243 for seven in their second innings at tea, a lead of just 139.
Medium pacer Shaun Pollock made the initial breakthrough for South Africa in the 10th over of the day when he trapped Younis Khan in front for 38 to end a partnership of 57.
Imran Farhat fell in the third over before lunch when he prodded forward to a delivery from Harris and was caught by AB de Villiers at silly point. Farhat hit 10 fours in a gritty 68.
Faisal Iqbal (9) drove uppishly at a ball from Harris to be caught by Herschelle Gibbs at extra cover and Pakistan dwindled to 187 for six when Inzamam-ul-Haq (35) smashed a delivery from Pollock only to be spectacularly caught by De Villiers at short midwicket.
Harris struck again in the ninth over before tea when Kamran Akmal, who scored 15, swept at a legside delivery and gloved a catch to short fine leg where Gibbs obliged again.
Pakistan rallied after that with Shahid Nazir (31) and Naved-ul-Hasan (14) both not out at tea.