Visitors were dismissed for 294 runs in their second innings
Pakistan have set South Africa a target of just 41 runs during the second Test of the three-match series in Cape Town.
The visitors were dismissed for 294 runs in their second innings with Kagiso Rabada and Dale Steyn claiming four wickets each.
Pakistan's Shan Masood and Asad Shafiq scored half-centuries as they led a fightback against South Africa on the third day.
Shafiq and Masood effectively dealt with a barrage of hostile bowling from the hosts' four-man seam attack in a 132-run partnership for the third wicket.
But Pakistan, dismissed for only 177 in their first innings, were not able to set the home side a competitive target as they were only able to accumulate 294 runs in their second innings.
Masood was promoted up the order in a bid to shore up a brittle batting lineup but saw his first two partners depart cheaply as Pakistan lost Imamul Haq and Azhar Ali, who both scored six runs each, and scored only 27 runs before lunch.
Home hopes of rattling through the rest of the batsmen after lunch were stymied as Asad proved aggressive, with his half-century coming off 56 balls.
Masood was more circumspect, resisting the temptation to hook or pull as he was peppered with rising deliveries, and took 98 balls to reach 50. But he edged a Dale Steyn delivery behind to wicketkeeper Quinton de Kock — after scoring 61 runs — just before tea for the home side's only wicket of the session.
Shafiq was then joined by Babar Azam but their fourth wicket stand only yielded 35 runs despite threatening to go big — with Shafiq departing after a fine knock of 88 runs.
Zaman was sent in to bat at number six but that ploy failed to deliver as he went back to the hut after scoring just seven runs as he top-edged a short ball from Rabada — who took the catch off his own bowling.
Pakistan captain Sarfraz Ahmed (6) was given out leg-before-wicket off the bowling of Duanne Olivier — giving the pacer his first wicket of the innings.
Steyn accounted for the wickets of Pakistan tailenders Mohammad Amir (0) and Yasir Shah (5).
Rabada claimed the final two wickets of the innings which included the prized scalp of Babar Azam (72) and Shaheen Shah Afridi (14).
Earlier the Proteas were bowled out for 431, amassing a massive 254-run first innings lead.
Mohammad Amir took three wickets in a lively start to Saturday's play as South Africa resumed on 382-6 and added 49 more runs before being bowled out. He removed De Kock for 59 and then tumbled the wickets of Vernon Philander and Rabada for figures of 4-88.
South Africa will start their second innings on day four of the Test match on Sunday, January 6.