Sri Lanka, looking to square the three-match series 1-1, were in complete command after 14 wickets tumbled on the second day of the second Test against South Africa at Kingsmead, on Tuesday.
The home team, replying to Sri Lanka's 338, were skittled for 168 in 54.4 overs before the visitors reached seven for one at the close of play.
Captain Tillakaratne Dilshan was the one Sri Lankan wicket to fall in the second innings, caught in the slips off paceman Dale Steyn for four before the umpires called an early halt to play due to bad light.
Earlier, fast bowler Marchant de Lange grabbed seven for 81 on his debut for the home side.
Sri Lanka were grateful to the 35-year-old Thilan Samaraweera who scored 102 to steer his team to their highest total in South Africa, beating the previous best of 323 at Centurion in 2002-03.
His 13th Test century was only the second ton by a Sri Lankan in this country, after Hashan Tillekeratne's 104 not out in that same Centurion Test.
South Africa were then blown away by Chanaka Welegedara, who claimed career-best figures of five for 52, and spinner Rangana Herath (4-49).
The hosts, who have lost the last three Tests at Kingsmead, collapsed dramatically after tea as they lost their last seven wickets for 65 runs.
AB de Villiers (25) steered Welegedara straight to second slip just after the restart and top-scorer Hashim Amla (54) edged a flat-footed prod off the same bowler to wicketkeeper Dinesh Chandimal.
Ashwell Prince was then caught for 11 trying to reverse-sweep Herath who also removed Mark Boucher for three and Morne Morkel for a duck as South Africa crashed to 119 for eight.
The home team only avoided the follow-on thanks to battling knocks from the tailenders.
Imran Tahir was stumped for 11 off Herath before last man De Lange was caught behind for nine off Welegedara.
Steyn decided attack was the best form of defence and he struck two fours and two sixes in an unbeaten 29.
Samaraweera saves the day for SL, impressive debut for De Lange
De Villiers misses ton but South Africa in command
Philander rocks Lanka as SA clinch win inside three days
SA in charge after Philander rocks Lanka
Stats, 1st Test, Day 2: Many milestones for Tendulkar, Dravid