CAPE TOWN - A Sri Lankan line-up that was dismissed for under 190 in the first three ODIs and had not topped 300 in any format on the current tour of South Africa made a fist of chasing a record total at Newlands, but eventually fell 40 runs short. South Africa's batsmen filled the boots by posting the highest total at the ground, overtaking the 354 for 3 they put on against Kenya in 2001. It proved enough to extend their winning streak at home to 13 matches and put them one win away from the No.1 ODI rankings.

Quinton de Kock scored his first fifty of the series, AB de Villiers his 50th ODI fifty, but Faf du Plessis stole the show. His second century of the series also made him the holder of the second-highest individual score by a South African, surpassing de Kock's unbeaten 178 against Australia in September 2016 and three runs short of Gary Kirsten's 188* against the UAE at the 1996 World Cup.

Sri Lanka's reply started strongly as Upul Tharanga and Niroshan Dickwella plundered 100 runs off the first ten overs. Tharanga went on to score the first century by a Sri Lankan batsman on this trip but was dismissed in the 30th over. It left Sri Lanka with a tough task of having to sustain that momentum.

Sandun Weerakkody, playing in just his second ODI, ensured that by bringing up a maiden half-century to keep Sri Lanka within range,and even put them ahead of South Africa's score at times. After 45 overs, Sri Lanka were 317 for 7. In comparison, South Africa had only reached 317 at the end of 46 overs. But as is so often the case for South Africa, Imran Tahir came up with crucial incisions.

He took two wickets in his final over - trapping Nuwan Kulasekara lbw and having Weerakkody caught at backward point - to leave Sri Lanka needing 51 off the last four overs with just one wicket standing. They didn't get there, but neither have 22 other chasing teams in day-night matches at Newlands. Sri Lanka, however, put on the most runs among all sides that have attempted a successful chase.

 Scoreboard

SOUTH AFRICA:

H Amla c Gunaratne b Kumara 1

Q de Kock c Tharanga b Pathirana 55

Du Plessis c Gunaratne b Madushanka 185

A de Villiers b Pathirana 64

J Duminy c Mendis b Kumara 20

F Behardien not out 36

W Parnell not out 1

EXTRAS: (nb1, w4) 5

TOTAL: (5 wkts, 50 overs) 367

FOW: 1-3, 2-103, 3-240, 4-287, 5-361.

BOWLING: Kulasekera 10-0-74-0, Kumara 7-0-73-2, Madushanka 10-0-69-1, De Silva 3-0-18-0, Sandakan 8-0-62-0, Pathirana 10-0-55-2, Gunaratne 2-0-16-0.

SRI LANKA:

N Dickwella c Behardien b Pretorius 58

U Tharanga c Duminy b Parnell 119

K Mendis c De Kock b Parnell 29

S Weerakkody c Parnell b Tahir 58

D de Silva lbw b Rabada 5

A Gunaratne c Amla b Rabada 38

N Kulasekera lbw b Tahir 1

S Pathirana c De Kock b Pretorius 1

L Madushanka c Pretorius b Parnell 6

L Kumara not out 1

L Sandakan b Parnell 1

EXTRAS: (lb7, w3) 10

TOTAL: (all out, 48.1 overs) 327

FOW: 1-139, 2-203, 3-216, 4-228, 5-307, 6-308, 7-317, 8-325, 9-325

BOWLING: Parnell 9.1-0-58-4 (1w), Pretorius 8-0-55-2 (1w), Duminy 1-0-12-0, Rabada 9-1-50-2 (1w), Imran Tahir 10-0-76-2, Shamsi 10-0-60-0, Behardien 1-0-9-0

TOSS: South Africa

UMPIRES: Adrian Holdstock (RSA), Richard Illingworth (ENG)

TV UMPIRE: Richard Kettleborough (ENG)

MATCH REFEREE: Richie Richardson (WIS)

TOSS: South Africa

UMPIRES: Adrian Holdstock (RSA), Richard Illingworth (ENG)

TV UMPIRE: Richard Kettleborough (ENG)

MATCH REFEREE: Richie Richardson (WIS)