Durban - Sri Lanka continue to fight hard, but it is looking almost certain now that South Africa will win the first Test at Kingsmead.
When bad light stopped play on day three on Friday, the visitors were 83/3, needing a further 221 for a highly unlikely victory.
Debutant Oshada Fernando (28*) and Kusal Perera (12*) are at the crease for the visitors while Kagiso Rabada (1/28), Vernon Philander (1/13) and Duanne Olivier (1/3) have a wicket each.
SCOREBOARD: SA v SL - 1st Test
By the end of the day, with the floodlights burning bright, the Proteas were bowling spin from both ends to stay on the field with Keshav Maharaj and Aiden Markram operating.
Earlier, skipper Faf du Plessis (90) and wicketkeeper Quinton de Kock (55) combined for a 96-run fifth-wicket stand that effectively put the game out of Sri Lanka's reach.
The visitors fought back, however, by taking the final five wickets of South Africa's second innings for just eight runs in a rot that saw Du Plessis out LBW by not offering a shot against Sri Lankan left-arm seamer Vishwa Fernando.
Bowling around the wicket, Fernando had angled the ball into the stumps and Du Plessis completely misjudged the line.
Fernando (4/71) and spinner Lasith Embuldeniya (5/66) were the men responsible for South Africa's lower order collapse that saw Vernon Philander (18), Keshav Maharaj (4), Kagiso Rabada (0) and Dale Steyn (1) all fall in quick succession.
De Kock, meanwhile, carded his second half-century of the match and looked to be cruising before he was trapped LBW looking to work Embuldeniya through the leg side.
The late surge gave Sri Lanka just the slightest of chances, and through opening batsmen Dimuth Karunaratne and Lahiru Thirimane they set about their chase in extremely difficult conditions.
With the light fading and the Proteas quicks charging in, the Sri Lankans relied on elements of luck at times as a few edges found their way through or over the slip cordon to the fence.
There was one moment, in particular, where Thirimane flashed hard at a wide one from Rabada. The ball flew off the edge towards the slip cordon and in-between Du Plessis and Elgar, who both left it alone.
Then, a couple of overs later, UltraEdge revealed that Rabada had found Karunaratne's outside edge, but none of the Proteas heard it and there was nothing more than a half-hearted appeal.
At that stage things were just not going South Africa's way and, even if it was still highly unlikely, Sri Lanka were giving themselves a small chance.
The breakthrough finally came through Rabada who, coming in from around the wicket, drew an outside edge from Thirimane.
This time the edge went to hand and skipper Du Plessis made no mistake in taking a sharp catch at second slip.
At 42/1, the Proteas were off the mark.
In the very next over Philander had his man when Sri Lankan skipper Karunaratne (20) was trapped LBW by one that moved back into him.
Karunaratne reviewed the decision and to the naked eye it looked like it might have been too high, but the DRS showed the ball clipping the top of leg stump.
With the umpires examining the light regularly, Olivier then struck in his first over of the innings when Kusal Mendis (0) played an incredibly poor shot trying to ramp a short ball over the slips only to edge through to De Kock.