This is at most of the times a common issue with the home team bundling up the opposition no matter by what margin they do it. And, this time South Africa were no different when they had Sri Lanka tumbling with a lag of 209 runs against the home team with one more wicket still to go. South Africa have in the recent past played some decent cricket with them outplaying India last year and then recently against Australia when they grabbed a 8 wicket win despite having been bowled out for 96 runs in the first innings. This was in Australia and not at home.
With the situation the South Africans are now in, it looks as though an innings win for them is high on the cards. There are three more days of play left in the game with Sri Lanka needing atleast 300 runs more than what the South Africans manage in the first innings in case they need to keep their hopes of saving the test alive. At present, with the South African scorecard reading 389 runs, assuming that they lose their last and final wicket with no more addition of runs, Sri Lanka as per calculation need atleast 689 runs to tame the hosts.
It is not an undisputed fact that a total of 689 is highly difficult though history has seen several such games where a team makes a surprise comeback after being shattered in the first innings. The best example for this would be the Kolkata test between India and Australia where Australia bundled out India for 171 only to see them lose the game after Steve Waugh imposed a follow-on. That match was famous for Laxman's 281 and Harbhajan Singh's Hat-trick. But, that test was played by India at home. Things cannot be assumed to be the same had the same been played away.
Similarly, I can recall Kamran Akmal and Asif Kamal spoiling India's party when they held the nerve in the Delhi test after India had taken a lead of 204 runs powered by Virender Sehwag's 173. The match that should have been won by India happened to end in a draw. Now, keeping in mind the batting line up of Sri Lanka, a miracle can be possible but with other factors also supporting the same. They have Mahela Jayawardane, Samaraweera, Sangakkara etc who can show some hopes with the bat. But, once again the problem lies in their bowling which can be self-destructing.