The third-wicket pair surpassed the previous best of 576 for the second wicket by fellow-Sri Lankans Sanath Jayasuriya and Roshan Mahanama against India at the Premadasa stadium here in 1997.
Skipper Jayawardene was unbeaten on 357 and Sangakkara hit 287 as Sri Lanka piled up 720-3 in their first innings by tea on the third day on Saturday, a lead of 551 over South Africa's meagre 169.
Jayawardene surpassed Jayasuriya's 340 against India to become Sri Lanka's highest individual scorer and, with no declaration in sight, is closing in on Brian Lara's world record score of 400 not out against England in 2004.
The record stand ended midway through the afternoon session on the third day when Sangakkara chased a wide delivery from Andrew Hall and was snapped by a relieved wicket-keeper Mark Boucher.
It was the best display by two batsmen in a Test innings since Garfield Sobers made an unbeaten 365 and Conrad Hunte 260 for the West Indies against Pakistan in Kingston in 1957-58.
Left-handed Sangakkara's career-best knock, surpassing his 270 against Zimbabwe three years ago, lasted 11 hours and 15 minutes during which he hit 35 boundaries.
Skipper Jayawardene was on 309 when he saw his partner depart and has so far hit 41 boundaries and a six during the marathon innings lasting 12 hours.
Tillekeratne Dilshan was the other batsman at the crease on 34.
The record came in the second over after lunch through four byes conceded down the leg-side by wicket-keeper Mark Boucher off left-arm spinner Nicky Boje.
Both batsmen, close friends off the field, hugged each other amid applause from some 4,000 home fans and bursting of firecrackers in the stands as umpire Mark Benson signalled the four byes.
Jayawardene, 29, and Sangakkara, 28, defied the hot and humid weather in the Sri Lankan capital to plunder the depleted South African attack.
Jayawardene, who is playing his 82nd Test, surpassed 6,000 runs during the course of his 15th three-figure knock. It is Sangakkara's 61st Test and his fourth double-hundred in 10 century-making innings.
The pair came together on Thursday evening with Sri Lanka struggling on 14-2 after seamer Dale Steyn removed openers Jayasuriya and Upul Tharanga in his first two overs.
There was little the South Africans could do to stop the rampaging Sri Lankans in good batting conditions.
The Proteas, already without the injured duo of skipper Graeme Smith and Jacques Kallis, also missed veteran all-rounder Shaun Pollock, who opted out of the match following the birth of his second child.
Pollock will be available for the second Test of the short two-match series which starts at the Sara stadium here on August 4.
Left-arm spinner Nicky Boje bore the brunt of the assault, conceding 221 runs in 65 unsuccessful overs. Steyn took 2-125 in 24 overs and Makhaya Ntini went for 0-81 in 28 overs.