Pakistan fought to save the first Test against South Africa after being set a world-record chase following magnificent centuries from Jacques Kallis and Hashim Amla on the fourth day on Monday.
Pakistan finished the fourth day at 109-2 with Azhar Ali on 37 not out and Younis Khan unbeaten on 11, still needing to bat out 90 overs on Tuesday for a draw or score a challenging 342 on a deteriorating Dubai Stadium pitch.
Set 451 to win, Pakistan lost openers Mohammad Hafeez (34) and Taufiq Umer (22) after both gave their team a confident 41-run start.
The best run-chase in all Tests is 418-7, achieved by the West Indies against Australia in Antigua in 2003, while Pakistan's successful target chase stands at 315-9, also against Aussies, at Karachi in 1994.
Pakistan can take heart from the fact they held South Africa to a draw in Lahore three years ago by scoring 316-4, but on a disheartening note they have never scored 400 runs in the fourth innings of a Test.
Earlier, Kallis made 135 and Amla 118 as Pakistan, left a bowler short after paceman Wahab Riaz's injury on the first day, toiled hard against the two right-handed batsmen before Graeme Smith declared the second innings at 318-2.
Amla and Kallis put on 242 runs for an unbroken third-wicket stand -- a new record against Pakistan, beating the 207-run stand Kallis put on with Graeme Smith in Lahore three years ago.
Kallis was the more aggressive of the two as he hit eight boundaries and four towering sixes -- three of those off spinner Saeed Ajmal and one off left-armer Abdul Rehman -- during his attractive 218-ball knock.
Amla, the most improved batsman at international level this year, notched ten boundaries during his 225-ball stay at the crease.
It was Amla who reached the three figure mark first.
The bearded 26-year-old hit Gul through point to reach 97, then took a couple and in the next Rehman over reached his 11th Test hundred with a single. He hit nine boundaries and took 190 balls to reach three figures, his fourth this year.
In the next over Kallis completed his 36th Test century off 185 balls which included seven boundaries and two sixes.
Resuming at 139-2, South Africa continued to build their lead through Amla and Kallis as Pakistan's bowlers failed to fully test the batsmen.
Amla was the first to reach his half-century, pushing paceman Gul for a single to reach the landmark. He hit five boundaries for his 16th Test half-century.
Kallis, who hit Ajmal for six off the first ball he faced in the day, also completed his second half-century of the match -- the 55th of his career -- with a single off spinner Abdul Rehman.
The second Test starts in Abu Dhabi from November 20.