South Africa gained the upper hand in the first Test at St George's Park as Sri Lanka failed to capitalise on an impressive bowling performance.
Having slumped from 104 without loss to 267-6 on Monday, the Proteas added just 19 runs to their total at the start of day two, Suranga Lakmal (5-63) completing his maiden five-wicket haul in Tests.
However, Sri Lanka could only muster 181-7 in reply to South Africa's 286 all out, with Vernon Philander (3-35) and Kyle Abbott (2-49) a constant threat.
The tourists' score at the close, which was brought forward by bad light, actually represented something of a recovery after they had taken tea on 104-5 and lost Dinesh Chandimal (28) early in the evening.
While Philander and Abbott bowled with typical accuracy, many of Sri Lanka's batsmen were guilty of giving their wickets away through loose strokeplay, and much is now likely to depend on Dhananjaya de Silva, who reached stumps unbeaten on 43.
Tuesday began encouragingly for Angelo Mathews' men as the hosts' first innings was brought to a swift end.
Philander (13) was caught at deep square-leg off Nuwan Pradeep (2-66) in the fifth over of the morning, having been dropped on 11, and Lakmal - the star of the opening day - claimed his fifth scalp by having Keshav Maharaj caught behind before Abbott was needlessly run out.
Pradeep finished things off in style, cleaning up Quinton de Kock (37) with an inswinging yorker, but Sri Lanka were soon struggling in reply.
A full delivery from Abbott forced Dimuth Karunaratne (5) to play on, while Kusal Perera (7) was caught behind aiming a loose cut at Philander.
Kusal Mendis soon followed for a duck, wicketkeeper De Kock taking a fine catch to his right off Abbott, and the score read 61-4 when Kaushal Silva (16) was plumb lbw to a nip-backer from Philander, who had set the opener up with a succession of outswingers.
Two South African reviews were wasted on Mathews, but Sri Lanka's captain - hit on the right elbow by Philander early in his innings - eventually edged Kagiso Rabada to third slip to fall for 39.
Having looked all at sea against Abbott after tea, Chandimal was then lbw to Philander, having been lucky to escape a similar verdict on four and dropped by De Kock on 17.
From 121-6, Sri Lanka rallied through Dhananjaya and Herath, who scored exclusively through the leg side. However, the veteran spinner departed for 24 when he missed an attempted reverse-sweep off Maharaj.