With this feat, he has become just the tenth South African batsman to register 4000 runs in Test cricket.
Jacques Kallis, Hashim Amla, Graeme Smith, AB de Villiers, Gary Kirsten, Herschelle Gibbs, Mark Boucher, Daryl Cullinan, and Faf Du Plessis are the other Proteas batsmen who have more than 4000 runs in Test cricket.
4⃣0⃣0⃣0⃣ Test runs for Dean Elgar – only the tenth South Africa batsman to reach the mark 🙌#SAvSL https://t.co/Ld4i6a41mc
— ICC (@ICC) 1609677748000
Earlier, opting to bat first, Sri Lanka got off to a bad start as the side lost its skipper Dimuth Karunaratne (2) in the 10th over of the innings and the left-handed batsman was sent back to the pavilion by Anrich Nortje.
Lahiru Thirimanne then joined Kusal Perera in the middle and the duo put on a quickfire stand of 52 runs, which saw the latter going past his half-century mark. But South Africa staged a comeback as Wiaan Mulder dismissed Perera (60) and Kusal Mendis (0) in the 21st over of the innings. On the cusp of the lunch break, Mulder and Nortje sent Thirimanne (17) and Minod Bhanuka (5) back to the pavilion, reducing Sri Lanka to 84/5.
After the lunch break, Sri Lanka was further reduced to 112/7 as Nortje got the scalps of Niroshan Dickwella (7) and Dasun Shanaka (4) and this left the visitors staring down the barrel. Wanindu Hasaranga (29) and Dushmantha Chameera (22) stitched a brief 39-run stand, but Proteas stuck to their guns and they bundled out the visitors for just 157.
For the Proteas, Nortje scalped six wickets while Wiaan Mulder took three wickets.
South Africa had defeated Sri Lanka by an innings and 45 runs in the first Test of the two-match series.