South Africa 376 (Rudolph 102) and 7 for 0 need 318 more runs to win beat Sri Lanka 486 and 214 for 9 dec (Jayasuriya 74, Boje 5-88)
Scorecard and ball-by-ball details

Boeta Dippenaar survives a loud appeal towards the close of play © AFP

South Africa's bowlers led the fightback, and Marvan Atapattu's declaration towards the end of the day - setting a tricky target of 325 - left the first Test at Galle intriguingly poised. After wrapping up the South African tail early in the day, Sanath Jayasuriya, with 74, led the charge towards a massive lead. But the bowlers never let the Sri Lankan batsmen cut loose as wickets fell steadily throughout the afternoon, thereby delaying the declaration.

Realistically, South Africa can only hope for a draw. The pitch, which has grown increasingly variable in bounce, was offering vicious turn towards the end. While not yet the minefield that had been predicted, survival itself will be hard, let alone run scoring. But South Africa, who will take heart from England's great escape last year when they finished on 210 for 9 after digging in for 108 overs, have improved their chances of scraping home with a plucky effort over the four days.

But thus far they have been outgunned by a vibrant Sri Lanka team and it was Jayasuriya that led the batting charge today, adding 62 runs with Atapattu (25) before a grubber from Lance Klusener cannoned into Atapattu's shins. Kumar Sangakkara was in fine form, cutting and driving Nicky Boje for two boundaries, but, much to his disgust, was then caught at long-off after a horrible miscue. Mahela Jayawardene, the first-innings double centurion, will also want to quickly forget his inside-out lofted drive that fell into the safe hands of Jacques Rudolph at long-off (103 for 3).

Sri Lanka reached the tea interval at 112 for 3. Afterwards they tried to accelerate but the departure of Jayasuriya, who looked destined for a 13th Test hundred, was a major blow. Jayasuriya had not been at his electric best, working hard for his runs and hitting just six fours, but some late afternoon fireworks would have allowed an earlier declaration. Instead, though, he nicked an innocuous offcutter from Shaun Pollock, who was bowling from a short run, as he tried to dab down to third man (140 for 4).

The breakthrough prompted a small flurry of wickets as, next over, Pollock pinned Tillakaratne Dilshan leg-before with a late inswinger. Thilan Samaraweera was defeated by another low-bouncing skidder from Klusener, another sign that the pitch was starting to deteriorate faster, and Romesh Kaluwitharana was beaten by some extra turn from Boje and caught at slip. Upul Chandana chipped in with a brisk 29 from 40 balls before the declaration finally came. Boje finished with a rich haul of 5 for 88.

South Africa's openers, Graeme Smith - now restored to full health - and Boeta Dippenaar safely negotiated the three overs before close. There was one massive, but speculative, appeal for a bat-pad off Dippenaar in the final over but no other great alarms. But that delivery, which exploded back from way outside off, will leave a seed of doubt in the South Africa dressing room as they prepare for a crucial final day.

At the start of the day, the first-over fall of Boje broke the back of South Africa's first-innings resistance, as Sri Lanka bowled them out for 376 to clinch a valuable 110-run lead, and allowing them to take back full control. South Africa added just 29 runs in an hour, but Rudolph at least managed to scramble the 15 he needed to complete a richly-deserved fourth Test century, an epic marathon of patient defiance that lasted nearly seven hours and spanned 297 balls.

Jacques Rudolph - a picture of concentration as he spent 297 balls for his 102 © AFP

Sri Lanka needed only four balls to break through as Boje, who failed to add to his overnight 31, glanced a leg-side catch to Kaluwitharana, who swept up the ball with a neat one-handed pouch (348 for 8).

Having broken the eighth-wicket stand, which had yielded 53 runs, Muttiah Muralitharan was pushed into action to mop up the tail. Makhaya Ntini, swinging wildly, slogged a brace of boundaries, but eventually skied a catch to Chandana at deep midwicket to leave Rudolph on 91 not out as Nantie Hayward, the last man, strode to the crease.

Rudolph held his nerve, farming the bowling and creeping closer with singles at the end of overs. He could have been caught behind on 96, when a thick edge evaded Kaluwitharana's bright yellow gloves, before squeezing a couple of runs off an inside edge to reach surely the most hard-working hundred of his career.

But Muralitharan, who yesterday moved ahead of Shane Warne when he took wicket No. 528, wrapped up the innings to finish with 4 for 130 from 46.4 overs. Clearly, without the doosra, wicket-taking will be tougher in the coming weeks. But come the final day, when South Africa try and battle on a dusty pitch, he will remain Sri Lanka's lynchpin.