Mahela Jayawardene resurrected Sri Lankan hopes with a defiant undefeated 77 © Getty Images

Those with a nervous disposition should loyally go to work tomorrow morning. The rest should pull a sickie and make sure they are comfortably seated (away from any potential TV cameramen) in the P Saravanamuttu Stadium, or in front of their television sets at home, because a fascinating Test match is now set up for a nail-biting finale. South Africa, as they have done for three days, have their noses in front but Sri Lanka, like they have also done for three days, keep scrambling back just when you think they are out of the race.

South Africa had a good first hour thanks to a feisty 65 from Mark Boucher, an innings that pushed the lead past 350, a daunting prospect anywhere in the world and a terrifying chase in Sri Lanka where the highest ever chase in 81 matches spread over 25 years is just 326 - and that against Zimbabwe on a belter at the SSC. They might have got even more were it not for Muttiah Muralitharan - who finished with 12 for 225, his fourth consecutive ten-wicket haul - and a miraculous short leg catch from Tillkaratne Dilshan that left Boucher, who had just middled a slog-sweep, utterly gobsmacked.

Sri Lanka's good fortune held throughout the day as South Africa had a bad day in the field. There were missed run outs, fumbled pick-ups and at least four dropped chances, the most expensive of which has proved to be Hershcelle Gibbs's in the gully off a rasping cut stroke from Mahela Jayawardene - a difficult catch but no harder than the pinging slip chance he'd snapped up off Upul Tharanga against the new ball . A spilled chance just before the close at short leg off Prasanna Jayawardene may also prove costly.

South Africa appeared to be on the final straight shortly after tea as Tillakaratne Dilshan and Chamara Kapugedera perished, leaving Sri Lanka at 201 for 5. But Mahela, the last specialist batsman, then resurrected Sri Lankan hopes with a defiant undefeated 77. After his wasteful first-innings dismissal, he regained the unblinking focus at the Sinhalese Sports Club, patiently defending but also picking off any delivery that was marginally off-target. With Prasanna once again impressing, showing great pluck in a pressure-cooker atmosphere, Sri Lanka inched 61 runs closer before stumps were drawn.

Sri Lanka now have eight overs before facing the second new ball, possibly the decisive passage of play in this Test. There is still some life in the pitch for the quicks and, if Dale Steyn can work up a similar pace to what he produced this evening, the speedometer touching 95mph once, then Sri Lanka's lower order are in for a testing time. If they can weather the new ball then the momentum will finally swing Sri Lanka's way. They will be hoping that Makhaya Ntini's hamstring twinge, an injury that prevented him from bowling in the final session, does not make a miraculous overnight recovery.

Charlie Austin is Cricinfo's Sri Lankan correspondent