Skipper Misbah-ul-Haq and Azhar Ali led Pakistan's fightback with half-centuries apiece to keep South African hopes of enforcing the follow-on at bay on the third day of the second Test on Monday.
Misbah finished with 77 not out to guide his team to 317-6 at the close after Ali (90) and Asad Shafiq (61) also contributed in a fight for survival with Pakistan still needing another 68 to avoid following on.
Abdul Rehman was the other unbeaten batsman without scoring.
Pakistan trail South Africa's first innings score of 584-9 declared by 267 runs on an Abu Dhabi Stadium pitch which is still not offering any real help to the bowlers.
South Africa pushed hard to enforce the follow-on and to press their chances of winning the two-match series after the first Test in Dubai ended in a draw last week.
Misbah, who reached his sixth Test half-century with consecutive boundaries off Dale Steyn, has so far hit nine boundaries and a six during his 150-ball knock and will have to continue on day four to avoid the follow-on.
South Africa's bowlers, led by Steyn (3-78) and left-arm spinner Paul Harris (2-71), managed just one wicket in the morning session and two each in the second and third.
Misbah added an invaluable 107 for the fifth wicket with Shafiq and then 46 for the sixth with Adna Akmal, who fell five overs before the finish, to Harris, after scoring 17.
Steyn had removed Younis Khan (14) and Ali in the space of five balls to raise hopes of enforcing the follow-on as Pakistan slumped to 156-4 from 153-2 soon after lunch.
But Misbah and Shafiq defied all such attempts, batting confidently to thwart the South African pace-cum spin attack. Both hit off-spinner Johan Botha for three boundaries each in successive overs to take Pakistan to 220-4 at tea.
South African captain Graeme Smith took the second new ball in an attempt to break the partnership, but it was Harris who brought the breakthrough with the wicket of Shafiq, caught in the slip by Jacques Kallis.
Shafiq hit ten boundaries during his 118-ball stay at the crease.
South African coach Corrie van Zyl said his team needs to continue the good work.
"We just have to come and do the same on Tuesday," said van Zyl. "The quicker we can get the last four wickets in terms of time and then we can have a second go or enforce the follow-on."
Shafiq said Pakistan needed to keep batting well.
"I was a bit nervous at the start, but after two-three overs I got the confidence," said Shafiq. "We need to bat well so that the follow-on is avoided and we can't afford to relax."