Sri Lanka's slow bowlers have spun a web around South Africa, who collapsed for a meagre 126 to concede a significant first-innings lead on a spin-dominated second day of the opening Test.
Touring captain Faf du Plessis spent his 34th birthday trying to save his team's blushes but even his fighting 49, the only 20-plus score in the innings, couldn't stop South Africa registering their lowest total in Sri Lanka.
Boosted by a first-innings lead of 161, the hosts drove home the advantage to finish Friday on 4-111 for an overall lead of 272 runs and a victory in sight.
Former captain Angelo Mathews, who was batting on 14 at stumps, and Roshen Silva on 10 will return on Saturday hoping to bat South Africa out of the contest in the first match of the two-Test series.
Resuming the day on four for one, the South African batsmen were all at sea against the turning ball and were reeling at 6-51 in the first session.
Du Plessis and Vernon Philander (18) arrested the slide and took South Africa past the 100-mark but then South Africa relapsed, losing their last four wickets for 11 runs.
Dilruwan Perera (4-46) led Sri Lanka's three-pronged spin attack with aplomb, while stand-in skipper Suranga Lakmal (3-21) also turned in a strong performance.
Spin reigned supreme in the final session as well with left-arm spinner Keshav Maharaj claiming 3-37 even though Sri Lanka kept stretching their lead.
Opener Dimuth Karunaratne continued to have a fruitful match, following his first-innings 158 with a fluent 60.