Pakistan fought hard to save the second Test against South Africa on the fourth day Thursday after Graeme Smith and Jacques Kallis hit hundreds to put the Proteas in a winning position.
Kamran Akmal (49) and Younis Khan (48) added 93 runs for the unbroken second wicket to take Pakistan to 108-1 at close, raising the home team's hopes of salvaging the match on the fifth day on a deteriorating Gaddafi Stadium pitch.
Smith scored 133 for his first hundred in 17 Tests, while Kallis made an unbeaten 107 to help the tourists declare their second innings at 305-4 -- setting Pakistan a record target of 457 to win and level the series.
Their efforts put the tourists in complete command to win their first Test series against a major sub-continent team since 2000. South Africa won the first Test in Karachi by 160 runs.
The highest target achieved in a Test is 418-7 made by the West Indies against Australia at Antigua in 2003 -- an indication of the scale of the task the home side face.
Pakistan fumbled at the start, losing Salman Butt (six) in the sixth over of the innings when he edged a Makhaya Ntini delivery to third slip.
But Akmal with seven boundaries and Younis with eight countered the South African attack before bad light ended play.
Smith said his team was still in a commanding position despite Pakistan's fightback. And the skipper said he was riding high after reaching his century.
His last Test hundred came against the West Indies at Antigua in May 2005.
"To score your first hundred on the subcontinent is very special and this series win is also going to be very special," said Smith, whose team lost a two-Test series here in 2003.
Earlier, Pakistan had all but squandered any chances of levelling the series in the morning session when they failed to dislodge Smith and Kallis after the tourists resumed at 154-2.
The confident pair were untroubled to consolidate their team's lead during a record stand of 203 for the third wicket.
Smith, 75 overnight, became cautious after entering the 90s before he pushed part-time bowler Younis Khan for several runs in the last over before the interval to complete his century -- his first in 17 Tests.
Pakistan's problems were compounded by the absence of frontline paceman Mohammad Asif who aggravated an elbow injury on Wednesday.
Scans revealed Asif has inflammation in his elbow and needs a week's rest to recover, ruling out any chances of him bowling in this match. He bowled just four overs in South Africa's second innings.
Asif's new-ball partner Umar Gul, who took one wicket, also had to return to the dressing room due to fatigue.
Captain Shoaib Malik was forced to operate with leg-spinner Danish Kaneria and left-arm spinner Abdul Rehman after taking the second new-ball -- something unseen in Pakistan cricket.
To add to Pakistan's woes, Malik dropped a skier off Kallis when the batsman was on 47 -- denting Pakistan's hopes of a breakthrough.
Kaneria finally broke the stand when Smith miscued a sweep and was caught at point. Smith's 296-ball knock had 17 boundaries.
Kallis reached his hundred in 336 minutes, hitting seven boundaries and taking his tally for the series to 421.
He improved his own South African record for a short two-match series of 388 which he made against Zimbabwe six years ago.
Rehman then bowled Ashwell Prince for 11 to finish with 2-112. AB de Villiers was unbeaten on eight when the Proteas declared.