Faf du Plessis' side have only three recognised batsmen remaining and two full days left to survive against Sri Lanka, now ranked sixth after a string of defeats in recent times.
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.
In the second innings, both the openers of Sri Lanka, Danushka Gunathilaka and Dimuth Karunaratne, got half-centuries.
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.
Cape Town - Proteas opening batsman Dean Elgar admits that Sri Lanka have been the better team in the two-match Test series.
He does have a record in domestic cricket and for South Africa A in being able to bat long periods which is a prime requirement for batting on the sub-continent.
But this will likely have only delayed the South Africans' first series defeat by Sri Lanka since 2006.
To say that the day belonged to Dananjaya would not be an understatement for before he wrecked the South African batting and frustrated their bowlers on the field by batting for almost two hours to score a career best 43 not out off 91 balls (7 fours).
Steyn has been tied with Shaun Pollock at the top of his country's wicket-takers' list since the first Test in Galle, with 421 dismissals.
Try as they might the South Africans could not separate the two until after the first drinks break for the day when Keshav Maharaj finally had Herath caught on the sweep shot to pick up his ninth wicket of the innings.
South Africa have been set an unlikely target of 490 runs to win the second test and draw the two-match series after Sri Lanka declared their second innings on 275 for five on Sunday.