South Africa need another 125 runs to win the third test and the series against Pakistan after reaching 36-2 at stumps Saturday on day two.
Captain Graeme Smith, who top scored for South Africa in the first innings with 64, was not out 33 at the close after Pakistan was bowled out for 186 at the Newlands Stadium with the series tied at 1-1.
South Africa bowled out Pakistan for 157 in it first innings Friday and made 183 in reply.
Resuming on 131-5, the Proteas lost their last five first-innings wickets for 52 runs.
Ashwell Prince was caught by Yasir Hameed off Danish Kaneria for 19 in the third over of the day. Paul Harris was caught for 1 in the slips by Younis Khan off Mohammad Asif two balls later and Andrew Hall faced 15 balls before being caught behind by Kamran Akmal off Kaneria for 4.
Mark Boucher and Dale Steyn took South Africa pass Pakistan's total in the 51st over, but Asif's pace and Kaneria's spin continued to prove too much.
Steyn was run out and Makaya Ntini was last man out for 3, as Boucher finished the innings with 40.
Kaneria took 3-44 off 20 overs and Asif had 3-53 from 16 overs.
Pakistan never really managed to establish any partnerships in its second innings.
Hameed (35), Sami (31), Shahid Nazir (27), Inzamam-ul-Haq (22) and Mohammad Yousuf (18) all got a start but didn't manage to build a substantial innings.
Steyn had 3-47 off 13 overs, while Jacques Kallis, Hall and Harris all took two wickets each.
With the target of 161 runs to win, South Africa lost Boeta Dippenaar for 3, caught by Akmal to Kaneria with the score at 30. Kaneria then had nightwatchman Harris out leg-before-wicket for a duck to finish with figures of 2-2 from 2.1 overs.