Tillakaratne Dilshan and Kumar Sangakkara pulverised South Africa's bowling as Sri Lanka took a decisive 3-1 lead in the one-day series with an eight-wicket victory in Pallekele on Sunday.
Dilshan returned unbeaten on 115 and Sangakkara made 91 during a record partnership of 184 runs to steer the hosts past South Africa's 238 all out in the 44th over of the day-night match.
Dilshan's 17th one-day century and the second against South Africa was studded with 16 boundaries. Sangakkara kept pace with his partner with eight fours and two sixes.
The pair put on Sri Lanka's highest one-day stand for any wicket against the Proteas after opener Mahela Jayawardene had been removed for 12 in the 10th over.
South Africa innings
H. Amla lbw b Dilshan 77
Q. de Kock b Malinga 8
JP Duminy b Mendis 97
AB de Villiers c Sangakkara b Dilshan 4
F. du Plessis st Sangakkara b Herath 23
D. Miller b Mendis 1
F. Behardien c Thirimanne b Mendis 0
R. Peterson c Sangakkara b Malinga 13
R. Kleinveldt c Dilshan b Malinga 8
M. Morkel lbw b Mendis 0
L. Tsotsobe not out 3
Extras (b-4) 4
Total (all out, 48.4 overs) 238
Fall of wickets: 1-17 2-118 3-126 4-172 5-173 6-173 7-191 8-203 9-205 10-238.
Sri Lanka innings
T.Dilshan not out 115
M.Jayawardene c Amla b Tsotsobe 12
K.Sangakkara c Kleinveldt b Morkel 91
L.Thirimanne not out 1
Extras (lb-2 nb-1 w-17) 20
Total (for two wickets, 44 overs) 239
Fall of wickets: 1-45 2-229.
Left-handed Sangakkara missed his second hundred in the series when he holed out in the deep off Morne Morkel when just 10 more were needed for victory.
Ragged South Africa paid dearly for conceding 20 extras that included 17 wides and a no-ball.
The emphatic victory by the 2011 World Cup finalists reduced Wednesday's fifth and final match in Colombo to a formality.
But Sri Lankan captain Angelo Mathews said he was unlikely to make many changes for the last game.
"We want to make it 4-1," Mathews said.
"I think we did well to restrict them after the good start they got. And then Dilshan and Sangakkara showed how good they are."
Earlier, JP Duminy hit 97 and a fit-again Hashim Amla made 77 to lift South Africa to 238 after the tourists won the toss and elected to bat.
But the Proteas undid a good start by losing eight wickets for 87 runs after cruising at 118-1 in the 22nd over.
"We were about 30 runs short," South African captain AB de Villiers admitted.
"It was a great knock there by JP because there was a lot more turn in the pitch.
"But credit to both Dilshan and Sangakkara for the way they batted. Our boys have fought hard and we want to win the last game."
Duminy lashed seven boundaries and two sixes before he was last man out in the 49th over, bowled by unorthodox spinner Ajantha Mendis three runs short of a century.
Mendis finished with four for 51, while sling-arm fast bowler Lasith Malinga claimed three for 52 and Dilshan took two wickets.
Amla, batting for the first time in the series after being injured while fielding in the only other game he played, anchored the start with a fluent half-century that contained nine boundaries.
Duminy shared a second-wicket stand of 101 with Amla after Quinton de Kock had been bowled by Malinga in the third over.
The one-day series will be followed by three Twenty20 internationals.