The hosts, replying to Pakistan’s first innings total of 551-6 declared, took their overnight score of 70-1 to 278-5 by stumps on the fourth day at the Sinhalese Sports Club.
Dilshan scored 121 and Sangakkara was unbeaten on 144 as the pair put on 225 runs for the second wicket.
Sri Lanka now need 74 more runs to save the follow- on today, the final day.
Ajmal under scanner
Meanwhile, concerns have been raised in Sri Lanka over the bowling action of Pakistan off-spinner Saeed Ajmal after the first Test in Galle.
J. Jayalalithaa passes away: Her life in pictures
Photos: Shah Rukh Khan, Deepika Padukone, Alia Bhatt at an awards show
Photos: Big B, Iulia Vantur at Himesh Reshammiya's album launch
Photos: Aamir Khan with 'Dangal' actresses at fashion show
Spotted: Twinkle Khanna, Shriya Saran at an event in Mumbai