South Africa were 122 for three at lunch on Monday, needing another 77 to take the lead in a three-match series.
Nightwatchman Paul Harris was the only batsman to be dismissed, caught at cover off Mohammad Asif for seven.
Hashim Amla (35 not out) and Jacques Kallis (22 not out) added an unbeaten 42 after Harris was out.
Play was restricted to 76 minutes because of a wet outfield caused by overnight rain.
South Africa resumed at 69 for two. Leg-spinner Danish Kaneria and opening bowler Mohammad Asif shared the bowling and Kaneria gained sharp turn at times.
Asif looked less dangerous but made a breakthrough when Harris drove uppishly and Faisal Iqbal held an easy catch.
After bowling seven overs he was replaced by off-spinner Mohammad Hafeez as Pakistan opted for an all-spin attack.
Amla, who was beaten twice in the first over of the day by Kaneria, looked more confident as the morning progressed.
Kallis, South Africa's senior batsman, started cautiously but hit some solid strokes against Kaneria shortly before the lunch break.
South Africa added 53 runs in 20 overs before lunch.
Pakistan 313 and 302 Vs South Africa 417 and 122 for 3 ( Amla 35 n o, Graeme Smith 32, Jacques Kallis 22 n o; Asif 2 for 56, Hafeez 1 for 14)