"We'll have a restless night," admitted coach Mickey Arthur.
"It certainly won't be easy. The ball is turning and their spinners can stop the game as well as attacking. The key tomorrow is to have a good partnership"
Needing 199 to win, South Africa were 69 for two at the close on Sunday.
Pakistan batsman Imran Farhat, who top-scored with 68 in his team's second innings total of 302, said leg-spinner Danish Kaneria will hold the key for Pakistan.
"Danish is a fantastic bowler and he's bowling very well in this match."
South Africa seemed headed for an easy win until they encountered aggressive resistance from Pakistan's tailend batsmen and suffered the loss of their captain Graeme Smith, who was leg before to part-time off-spinner Mohammad Hafeez in the last over of the day.
Left-arm spinner Paul Harris took four for 46 as Pakistan were bowled out in their second innings. But the last three wickets added 103 runs.
Harris and seamer Shaun Pollock bowled with tight control as Pakistan were reduced to 199 for seven - a slender lead of 95.
Smith opted for the new ball to blast out the tail but the decision heralded a period of batting mayhem in which fast bowlers Andre Nel and Makhaya Ntini were thrashed to all parts of the ground.
Ignoring the niceties of technique and resorting to old-fashioned slogging, Shahid Nazir slammed a career-best 40 off 35 balls as he and Rana Naved ul-Hasan put on 56 for the eighth wicket before Nazir swung once too often and was bowled by Ntini.
Naved and Kaneria carried on meting out punishment to the bowlers, scoring 33 and 23 respectively before Smith called back Harris, who finished the innings with his second delivery.
"The players did a brilliant job until the second new ball," said Arthur.
"You've got to back the new ball to knock over the tail but we got a bit sloppy and it probably cost us 40 runs."
Harris at one stage conceded only six runs in nine overs as Pakistan found it difficult to score during the afternoon.
Playing in his second Test, Harris made a breakthrough shortly before lunch when he had Farhat caught at silly mid-off.
He followed up with the wickets of Faisal Iqbal, who drove a catch to cover, and Kamran Akmal, who tried to break the shackles imposed by Harris. Akmal hit two successive fours off the spin bowler but then top-edged a sweep to short fine leg.
Pollock claimed the crucial wicket of Pakistan captain Inzamam-ul-Haq with the help of a diving catch by AB de Villiers at midwicket. Inzamam made 35.
South Africa dropped four catches, with wicketkeeper Mark Boucher the culprit twice.
The left-handed Farhat, who survived a difficult chance to gully when he had seven Saturday, took most of the morning to advance from his overnight 41 but he was lucky to survive.
Without adding to his score, he edged Ntini to Jacques Kallis at second slip, with the ball reaching the fielder on the half-volley.
On 47, Farhat was dropped by Boucher off Ntini when Boucher dived in front of first slip Smith. Boucher later could not hold a leaping chance from Faisal Iqbal off Kallis but it was not expensive as Iqbal added only three more runs.
Farhat batted for 261 minutes, faced 167 balls and hit 10 fours.
De Villiers was soon out as South Africa started their chase but Smith and Hashim Amla put on 47 for the second wicket before Hafeez claimed Smith's wicket.
Pakistan 313 and 302 (Imran Farhat 68, Younis 38, Inzamam 35, Shahid Nazeer 40, Naved Rana 33; Harris 4 for 46, Pollock 3 for 60, Kallis 2 for 44) Vs South Africa 417 and 69 for 2 (Graeme Smith 32, Amla 17 n o; Hafeez 1 for 8, Asif 1 for 32)