Abu Dhabi: Skipper Misbah-ul-Haq and Azhar Ali led Pakistan's fightback with half-centuries apiece to keep South African hopes of enforcing 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 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. Resuming at 59/1, Pakistan's batsmen faced no problems as the Umer-Ali duo put on 117 for the second wicket stand before Jacques Kallis provided his team with its only breakthrough by dismissing Umer.
Ali hit paceman Morne Morkel for his eighth boundary to complete his fifth Test half-century -- his third consecutively in the series after hitting one in each innings of the drawn first Test in Dubai.
Ali then had a lucky escape when, on 64, he edged left-arm spinner Paul Harris towards forward short-leg where AB de Villiers juggled with the ball before dropping it.
Ali hit 12 boundaries during his 175-ball knock, falling two runs short of his Test best of 92, made against England at The Oval three months ago.
South Africa 584 for 9 declared (de Villiers 278*, Kallis 105, Ahmed 6-120)
Pakistan 317 for 6 (Ali 90, Misbah 77*, Shafiq 61, Steyn 3-78)
Status Pakistan trail by 267 runs