South Africa will need just 41 runs to beat Pakistan on day four of the second Test and take an unassailable 2-0 lead in the three-match series.
Asad Shafiq (88), Babar Azam (72), and Shan Masood (61) held up the Proteas in Cape Town on Saturday as Pakistan avoided an innings defeat.
The visitors were eventually dismissed for 294 - Dale Steyn (4-51) and Kagiso Rabada (4-61) sharing eight wickets - but the umpires decided that with a maximum of 30 minutes left in the day, 10 of which would be taken up by the changeover, South Africa would begin the chase on Sunday.
The Proteas may have had time had Vernon Philander dismissed Mohammad Abbas (10no) two overs earlier with Pakistan ahead by just 24 - but the seamer was shown to have overstepped once Rabada took a back-pedalling catch at mid-off.
South Africa had resumed Saturday morning on 382-6 but were all out for 431 to lead by 254 on first innings with Mohammad Amir (4-88) bagging three wickets, including Quinton de Kock (59).
Amir split Philander's leg stump in two when he bowled his fellow paceman off an inside edge for 16 and then went on to clean up Rabada (11).
Steyn was the final man out for South Africa - uppercutting Shaheen Afridi (4-123) to third man - and then made the first breakthrough in Pakistan's second knock with Imam-ul-Haq (6) slashing his pitched-up delivery to third slip.
Rabada made it 27-2 when he pinned Azhar Ali (6) lbw, only for Shafiq and Masood to unite for a 132-run stand, during which Masood successfully overturned an lbw dismissal against Philander on 24 with the paceman's delivery shown to be sliding down leg.
Shafiq notched his fifty from a brisk 56 balls and Masood his from a more sedate 98 as the pair frustrated South Africa's four-pronged pace attack until Masood snicked Steyn behind close to tea.
Shafiq, who was eyeing a 13th Test ton, then saw his fine knock came to a close after the interval when he pushed outside his off stump and edged Philander through to De Kock.
Fakhar Zaman (7), Sarfraz Ahmed (6) and Amir (0) came and went as Pakistan lost four wickets for 27 runs but Babar farmed the strike while batting with the tail and brought up his fifty from 55 balls before edging Rabada to slip.
Pakistan's innings was then unexpectedly extended late in the day, with Philander's no-ball forcing De Kock - who had sped off to put on his batting gear and open for South Africa - to make a U-turn.
Watch day four of the second Test between South Africa and Pakistan, live on Sky Sports Cricket from 8.25am on Sunday.