Keshav Maharaj returned the second best figures by a South African bowler in a Test innings but Sri Lanka took a firm step towards a 2-0 series sweep after thoroughly dominating day two of the second and final Test on Saturday.
South Africa's spin frailties were laid bare once again as the tourists collapsed for 124 to concede a first innings lead of 214 runs at Colombo's Sinhalese Sports Club Ground.
Sri Lanka, who made 338 in the first innings, were 151-3 at stumps after deciding not to impose follow-on against the tourists who now stare at the possibility of a second successive Test defeat inside three days.
Dimuth Karunaratne was batting on 59 at stumps, his fourth successive 50-plus knock in the series, with Angelo Mathews on 12 at the other end.
For South Africa, left-arm spinner Maharaj took his match-haul to 11 wickets but his team were in dire straits.
Earlier resuming the day on 277 for nine, Akila Dananjaya and Rangana Herath frustrated South Africa with a dogged 74-run stand for the final wicket before Maharaj struck when the latter was caught behind for 35. Dananjaya remained unbeaten on 43.
Maharaj's 9-129 is the second best by a South African in Tests, behind only Hugh Tayfield's 9-113 against England in 1957, but his success brought little cheer to a side battling their own spin vulnerabilities.
Herath and Dananjaya (5-42) returned from the innings break to harm South Africa with the new ball, reducing the leaden-footed tourists to 15 for three.
Dilruwan Perera (4-40) then joined the rout as South Africa lost all 10 wickets to the Sri Lankan spinners.
Faf du Plessis (48) and Quinton de Kock (32) counter-attacked but it was not enough as the tourists once again failed to reach the 150-mark in the series.