Steyn, 31, unleashed some fiery bowling without much help from a dry and flat track to finish with figures of 5-50, his 23rd five-wicket haul in Tests.
At stumps, Sri Lanka were 283-9, still trailing the visitors by 172 runs with just one wicket in hand.
Sri Lankan skipper Angelo Mathews fought back valiantly with an 89-run knock before being bowled by leg-spinner Imran Tahir.
Mathews, who missed scoring his third Test ton on the trot, also shared 71 runs with Rangana Herath for the eighth wicket, the highest partnership of the innings.
His effort was especially commendable since Sri Lanka`s two big hitters — Mahela Jayawardene (three) and Kumar Sangakkara (24) — failed with the bat.
Steyn struck early in the final session, removing Lahiru Thirimanne (38) with an away-moving delivery which the batsman edged behind to wicketkeeper Quinton de Kock.
The lanky fast bowler struck again soon to dismiss Dinesh Chandimal and Dilruwan Perera off his consecutive overs to cap a fiery three-wicket burst.
Chandimal (six) was caught at midwicket while Perera snicked to de Kock without opening his account.
Mathews tried to hit back, smacking Morne Morkel (2-45) for five fours in one over to race to his fifties but that was a rare show of dominance on an otherwise disappointing day for the home team.Earlier, Tharanga, making a Test comeback after more than six years, stood out with his doughty 83-run innings that contained 14 fours and a six.
Tharanga defied the hostile fast bowling for some three hours but he was finally undone by part-time spinner Jean-Paul Duminy who had him stumped by de Kock.
Steyn tasted the first success in the morning session when he got rid of opener Kaushal Silva (eight).
Silva tried to hook a bouncer from Steyn but edged it to long leg where Vernon Philander dived forward and plucked the ball inches off the ground to complete a spectacular catch.
His dismissal brought in Sangakkara, coming into the match on the back of a record seven successive fifty-plus scores.
The left-hander looked his normal poised self, pulling and driving Steyn for two fours in an over, which included his trademark cover drive.
Tharanga provided solid support to his more famous partner, reaching his fourth half-century with a four off Duminy.
Tharanga dished out similar treatment to Tahir, the only specialist spinner in the South African squad, whacking him around for two boundaries is his consecutive overs.
Sudden rain close to the lunch break held up the game briefly. And just as the match resumed, Sangakkara paid the price for losing his concentration, inside edging Morkel on to his stumps.
Jayawardene, who has announced that he will retire in August, was trapped leg before by Steyn while trying to defend against a stinging yorker from the bowler.
The former skipper asked for a review but replays vindicated the on-field umpire`s call.