Perera and Mathews put on 62 runs for the 6th wicket but the hosts are still 311 runs behind India's first innings score of 600.
At the break, Perera and Lahiru Kumara (2) were at the crease.
Starting from overnight 154-5, Perera and Mathews continued from where they had left and extended their defiant partnership.
Umesh Yadav (1-78) and Ravindra Jadeja (2-67) got proceedings underway for India, but neither could trouble the duo as they brought up their 50-partnership off 96 balls.
Also Read
There was slight turn available for the spinners on this day three pitch and this wicket was a result of constant pressure built up by the left-arm spinner. In all, Mathews faced 130 balls inclusive of 11 fours and a six.
Two overs later, Perera survived a confident lbw shout off Jadeja via DRS. Originally, he was ruled out lbw but the review came out in his favour, surprisingly. The ball appeared to be sailing well over the stumps, unexpectedly though as seen from Kohli's astonished reaction.
At the other end though, stand-in skipper Rangana Herath (9) was not so lucky as he went for a reverse sweep off Jadeja and only ended up lobbing up the ball off his glove to Ajinkya Rahane at slip for a catch.
The batsman went in for DRS confidently assuming the ball had hit his arm, but Ultra-Edge replay showed that there was some glove involved.
Hardik Pandya (1-11) came on to bowl close to the end of session, and cleaned up Pradeep to claim his maiden Test wicket.
On day one, Shikhar Dhawan (190) and Cheteshwar Pujara (153) had scored contrasting centuries to put India in command at 399/3 at stumps.
On day two, Ajinkya Rahane (57) and Hardik Pandya (50) scored half-centuries to take India's first innings total to 600 runs. Sri Lanka were then reduced to 154/5 at stumps.
Disclaimer: No Business Standard Journalist was involved in creation of this content