Pakistan were inspired by a fiery unbeaten 93 from Younis Khan as they chased a record South African target featuring Jacques Kallis's second successive century in the first Test here on Thursday.
Pakistan, facing a world record chase of 424 runs, finished the fourth day on 146-3 with night-watchman Mohammad Asif on one, needing another 278 runs to win the Test in the remaining 90 overs on Friday.
Just when Younis and Faisal Iqbal (44) threatened the tourists with a solid 114-run stand for the third wicket, left-arm spinner Paul Harris dismissed Iqbal with three overs to go to set up an intriguing last day.
South Africa were indebted to Kallis who became only the fourth Proteas batsman to score a century in each innings of a Test. Kallis remained unbeaten on 100 to help his team declare their second innings at 264-7.
The world record for the highest target achieved was 418 which the West Indies made against Australia in Antigua in May 2003. Pakistan's highest successful chase is 315-9 against Australia made at the same ground in 1994. Pakistan had a disastrous start to their second innings, losing Mohammad Hafeez (one) in the second over of the innings when he played on to a Dale Steyn delivery.
Steyn then removed Salman Butt (three) in his third over when close-in fielder Hashim Amla smartly took a bat-pad push to leave Pakistan struggling at 20-2. Younis, who managed just six in Pakistan's first innings score of 291, made amends as he raced to his fifty off just 51 balls with his eighth boundary. Younis has so far hit 14 boundaries and a six during his 99-ball knock.
Pakistan now need a big effort from their batsmen to win or save the Test at the venue where they have only lost to England (2000) in 39 previous Tests. It was Kallis who put the tourists on the winning track as his second successive high-class knock demolished the home team's hopes of a fightback. Kallis hit only four boundaries and a six during his nearly five-hour stay at the crease, proving his claim to be the best South African batsmen in the longer version of the game.
The 31-year-old added 88 runs for the fourth wicket with Ashwell Prince (45) and another 63 runs for the sixth wicket with Andre Nel who made a Test best of 33. Nel's previous best of 23 not out was also against Pakistan at Port Elizabeth earlier this year.
Kallis, subdued after lunch with no boundaries for 55 balls, lifted Rehman to go within four runs of a twin hundred in the match. He took them all in singles to reach three-figure mark off 210 balls in 289-minutes. Alan Melville, Bruce Mitchell and Garry Kirsten were the other South Africans to score a century in each innings in Tests.
The tourists, looking for a match-winning margin on a spin-friendly pitch, resumed on 76-3 with a steady Kallis and Prince. The duo took the score to 132 without facing any problems. Kaneria, surprisingly kept out of attack in the first hour, provided the home team with the much-needed breakthrough.
Rehman then baffled AB de Villiers with a sharp turner to bowl the batsman for one. Debutant Rehman, who took four wickets in the first innings, was the pick of home bowlers with 4-105. Kaneria finished with 3-85. The second and final Test starts in Lahore from October 8.
-- South Africa 1st innings 450 (J. Kallis 155, AB de Villiers 77, Hashim Amla 71, H. Gibbs 54; Abdul Rehman 4-105)
-- Pakistan 1st innings 291 (Shoaib Malik 73; P. Harris 5-73)
-- South Africa 2nd innings: (overnight 76-3)
=====================================
G. Smith c Akmal b Rehman 25
H. Gibbs c Iqbal b Kaneria 18
H. Amla st Akmal b Rehman 0
J. Kallis not out 100
A. Prince b Kaneria 45
AB de Villiers b Rehman 1
M. Boucher c Haq b Kaneria 29
A. Nel c Haq b Rehman 33
P. Harris not out 1
-------------------------------------
Extras: (b10, lb2) 12
Total: (for seven wkts decl) 264
=====================================
Fall of wickets: 1-41 (Smith), 2-43 (Amla), 3-43 (Gibbs), 4-131 (Prince), 5-132 (De Villiers), 6-188 (Boucher), 7-251 (Nel).
Bowling: Asif 6-1-14-0; Gul 12-1-35-0; Rehman 38-6-105-4, Kaneria 28-3-85-3, Hafeeez 5-0-13-0
Overs: 89
PAKISTAN 2ND INNINGS:
=====================================
Mohammad Hafeez b Steyn 1
Salman Butt c Amla b Steyn 3
Younis Khan not out 93
Faisal Iqbal c Kallis b Harris 44
Mohammad Asif not out 1
-------------------------------------
Extras: (lb4) 4
Total: (for three wkts) 146
=====================================