When the umpires brought the players in for an early tea due to bad light, Sri Lanka were 203 for six wickets in their second innings and had an overall lead of 342 with four sessions remaining in the test.
Mathews was unbeaten on 48 with Dilruwan Perera the other not out batsman on nought. Sangakkara registered his 50th test half century with an aggressive 72 off 90 balls, including eight fours, before he was dismissed edging a Morne Morkel delivery to wicket-keeper Quinton de Kock.
Morkel also picked up two more wickets as the Sri Lankan batsmen attempted to keep the scoreboard ticking over.
Kithuruwan Vithanage (seven) was caught splendidly by Faf du Plesses at backward point off a top edge and Niroshan Dickwella (16) top edged a pull to lob up an easy catch for AB de Villiers at short square leg.
Wicketkeeper Dickwella was earlier fined 10 percent of his match fee and officially reprimanded by the match referee for claiming a catch on the bounce off De Villiers and celebrating it by throwing the ball in the air on Saturday.
Sri Lanka lost three wickets in the morning session, including that of first-innings centurion Mahela Jayawardene for a duck. Jayawardene was given out caught off his glove when he attempted to reverse sweep leg-spinner Imran Tahir. He immediately referred the decision but as there was no conclusive evidence to overturn the umpire's call, Jayawardene had to go and he trudged off unhappily, certain that the ball had hit his arm guard.
Resuming on 11-0, Sri Lanka made clear their attacking intentions when play began with Upul Tharanga straight driving the first ball of the day from Vernon Philander for four. Tharanga lived dangerously outside his off stump and eventually edged a delivery from Dale Steyn to De Kock to be dismissed for 30 following an opening stand of 38 with Kaushal Silva.
The first hour's play produced 55 runs in 13 overs but following the dismissals of Silva and Jayawardene, the second hour brought only 42 runs.
Silva's innings of 26 was ended by Morkel when he scooped a delivery to Philander at point.
South Africa lead the two-test series 1-0.