Middle-order batsman Temba Bavuma continued to resist against relentless Pakistan bowling as South Africa reached 188-7 at lunch on the third day of the second Test in Rawalpindi on Saturday.
Bavuma was unbeaten on 36 at the break and Keshav Maharaj, dropped by Yasir Shah off pacer Shaheen Shah Afridi, was not out without scoring.
South Africa still trail Pakistan's first innings total of 272 by 84 runs.
Bavuma survived umpire Ahsan Raza's decision on 16 when he was given leg-before off Hasan Ali, reviewing it successfully to continue his fight.
Resuming at 106-4 South Africa had hoped their skipper Quinton de Kock would build on his breezy overnight score of 24, but the left-hander played on to Shaheen in the third over of the day.
De Kock scored 29.
Bavuma and Wiaan Mulder frustrated Pakistan's pace-cum-spin attack during a 50-run sixth wicket stand before disaster struck.
Mulder nudged a push to deep fine-leg but while returning for a second run failed to beat a Shaheen throw and was run out.
George Linde hit three boundaries and a six in his quickfire 21 but missed the line of a Hasan delivery and was bowled.
Hasan has figures of 3-46.
Pakistan leads the two-match series 1-0 after winning the first Test in Karachi by seven wickets.