South Africa took the prized wicket of centurion Younis Khan to close in on a hard-fought win in the first Test against Pakistan at the National Stadium.
Younis scored 126 before he was bowled by paceman Dale Steyn to leave Pakistan on 230-5 at lunch on the fifth and final day, needing a further 194 runs to reach a victory target of 424, or to bat another 54 overs to draw the Test.
Misbah-ul Haq was unbeaten on 23 and captain Shoaib Malik on 15.
The target set by the tourists was six runs more than the current world record chase of 418-7 achieved by the West Indies against Australia at Antigua in 2003.
With Younis's dismissal, Pakistan's hopes of an unlikely victory were severely dented. Younis hit 18 boundaries and a six during his nearly four-hour knock and almost caused panic in the tourists' ranks.
He was the key for Pakistan after counter-attacking against the South African bowlers on Thursday during an unbeaten innings of 93. He led the way after the home team resumed at 146-3 Friday.
Younis flicked paceman Andre Nel over mid-wicket for his 15th boundary to reach his 13th Test hundred off just 108 balls. It was his first hundred against the Proteas and his first in the second innings of a Test.
Nel provided the tourists with the breakthrough when he had nightwatchman Mohammad Asif caught at short leg in the sixth over of the day. Asif made six.
Steyn, the pick of the South African bowlers with 3-48 in the innings so far, produced a sharp delivery that kept low and bowled Younis to put the brakes on the home team's charge.
South Africa could have removed Malik had AB de Villiers held on to a sharp chance off left-arm spinner Paul Harris, who did produce some sharp turners but failed to add to his one wicket taken on Thursday.