South Africa need six more wickets with two days still to play to win the second Test against Sri Lanka, who closed the third day at Newlands on Wednesday on 130 for four, still 377 runs behind the mammoth target set them.
Vernon Philander and Kagiso Rabada both took two wickets in the Sri Lankan second innings as the home team closed in on victory and an unassailable 2-0 lead in the series.
South Africa have ample time to whittle away the rest of the Sri Lankan batting while the visitors, set 507 runs to win, must survive six more sessions if they are to force a most improbable outcome.
Angelo Mathews (29 not out) and Dinesh Chandimal (28 not out) will resume on Thursday, having shown some resistance to the close of play with an unbeaten 61-run partnership.
Philander made an early inroad before tea when he clean bowled Dimuth Karunaratne for six and then added the wicket of Kusal Mendis after the break as he edged a ball on a tempting length to Dean Elgar for only four.
Kaushal Silva went for 29 runs when a rising Rabada delivery hit him on the glove and popped up for an easy catch for Stephen Cook.
Dhananjaya de Silva was then given out leg before wicket off a Rabada delivery that was heading down leg side but surprisingly did not ask for a review. Had he done so, De Silva would have been able to add to his 22 runs.
Sri Lanka were put into bat midway through the second session after the South African lead went past 500 runs. They declared on 224 for seven, having resumed at 35-0 overnight.
Seamer Suranga Lakmal took four wickets in a rare highlight for Sri Lanka while Elgar top scored for the home side with 55, to add to his first-innings century.
Captain Faf du Plessis made 41 while Stephen Cook was out for 30.
South Africa scored 392 in their first innings to which Sri Lanka replied with a paltry 110. The hosts, who won the first Test in Port Elizabeth last week, did not enforce the follow-on.