Sri Lanka now need 220 runs at 4.40 runs per over to take a giant stride towards booking their place in the semis and sending South Africa out of the tournament.
On the best wicket of the tournament so far, the South Africans were guilty of playing loose shots to give the upper hand to the Sri Lankans.
A couple of rash shots by Graeme Smith and Herschelle Gibbs and a brilliant catch by wicket keeper Kumar Sangakkara standing up to the stumps to Chaminda Vaas saw South Africa in early trouble at 30 for three.
However, de Villiers, who was brought into the squad with Jacques Kallis, set up repairing the innings eschewing all risks and being content to pick up singles and twos with the odd boundary.
Kallis looked like coming into his own hitting a huge six of pace bowler Dilhara Fernando, but was soon out as he stepped out to Sanath Jayasuriya to loft him, but was done in by the wily left armer beaten in flight for Sangakkara to essay an easy stumping.
De Villiers was then joined by Mark Boucher and the former reached his 50 when he pulled off spinner Muttiah Muralitharan to the mid-wicket boundary. Two balls later, de Villiers was back in the pavilion as he tried to clear long on only to sky the ball to Maharoof who took a well judged catch.
After the fall of de Villiers, the big hitting Kemp also fell for seven being bowled by S Jayasuirya.
A late charge by the eight wicket pair of Shaun Pollok (21 not out with a six) and Robin Peterson (22 with three fours and a six) who put on a valuable 42 in just 4.3 overs took South Aficans past the 200 mark to give their bowlers something to ball at.
Chaminda Vaas with two wickets for 16 in his 10 overs was the most economical bowler for Sri Lanka, while Lasith Malinga with 4 for 53 the most successful.