Rana Naved-ul-Hasan and Shahid Nazir had an unbroken stand of 44 to extend Pakistan's lead to 139 at tea on the fourth day of the first of three tests against South Africa.
South Africa had taken three wickets in the second session at Centurion Park to leave Pakistan on 199-7 before the eighth-wicket partnership took the score to 243.
Nazir had 31 from 28 balls and Naved was on 14 at the break.
Left-arm finger spinner Paul Harris had Faisal Iqbal caught by Herschelle Gibbs for 9 after lunch.
Captain Inzamam-ul-Haq was caught by a diving A.B. de Villiers at short midwicket for 35 off Shaun Pollock and Pakistan was 187-6.
Twelve runs later, Kamran Akmal tried sweep a ball from Harris and was caught by Gibbs at short fine-leg for 15.
Harris had figures of 3-46 and Pollock 2-32.
Resuming in the morning session on 103-2, Pakistan added just 12 runs before Younis Khan was out leg-before-wicket for 38 off the bowling of Pollock.
Imran Farhat, who was dropped by wicketkeeper Mark Boucher on 47 after edging a ball from Makhaya Ntini, was caught at silly point by De Villiers off Harris for 68.
The Proteas were dismissed for 417 in reply to Pakistan's 313 for a first-innings lead of 104.