Prince's gritty 60 from 170 balls, supported by an equally determined 38 not out from Mark Boucher, gave the tourists a glimmer of hope of saving the opening Test after the first three days were dominated by Sri Lanka.
Dismissed for 169 in their first innings, South Africa resumed their second on 43-0 after the hosts had piled up 756-5. The tourists still face the daunting task of batting out another three sessions to save the Test with just six wickets intact.
South Africa's openers Jacques Rudolph (90) and Andrew Hall (64) had earlier resisted the home side's bowlers during a record 165-run partnership before pace bowler Dilhara Fernando struck two important blows after lunch.
The tourists' rearguard faltered in the afternoon session as they crumbled from 165-0 to 185-3 but their resistance stiffened again in the final session with Sri Lanka able to claim just one more wicket.
Rudolph and Hall batted in a positive vein during the morning and, apart from one strong appeal for a bat-pad against Hall, on 34, looked rock-solid on a wearing but still docile pitch at the Sinhalese Sports Club.
After lunch, following his 4-48 in the first innings, Fernando toyed with Rudolph outside the off stump before finding the outside edge. Chamara Kapugedera took a fine low catch at second slip.
Opening in place of an unwell Herschelle Gibbs, Rudolph finished with 90 from 182 balls, having hit 13 boundaries.
RECORD STAND
The opening stand was a first-wicket record for South Africa against Sri Lanka, surpassing the 137 scored by Keppler Wessels and Andrew Hudson in 1993/94 at the same venue.
Fernando quickly followed up with the wicket of Hashim Amla (two) with a full-length in-swinging delivery that trapped the right-hander lbw.
Skipper Mahela Jayawardene, employing innovative fields, used a combination of pace and spin throughout most of the day and rotated most of the bowlers in short spells.
Spinner Muttiah Muralitharan, forced to toil uncharacteristically hard for his victims, claimed his first scalp of the innings when Hall was adjudged lbw to an off break bowled around the wicket.
Muralitharan struck again after tea when Jayawardene, trying to make it harder for the batsman to read Muralitharan's variations off the pitch, trapped AB de Villiers (24) lbw.
Muralitharan, though, failed to make further inroads as Boucher and Prince resolutely batted out the day. The 34-year-old spinner finished with two for 83 from 40 overs.
Fernando finished with 2-49 from 16 overs.
Gibbs will be able to bat only at number seven after being laid low by a virus during days two and three.
Stats: Records tumble for SL
Panesar, Harmison inspire victory
Vaughan fears he may not play again
'Warne has slept with 1000 women'
Laker bowling feat defied logic