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.
Photos: 'Dangal' girls Sanya Malhotra, Fatima Sana Shaikh's dinner outing
Photos: Salman Khan, Daisy Shah spotted at the Mumbai airport
Photos: Rakhi Sawant to play Honeypreet in Ram Rahim biopic
Photos: Arvind Kejriwal asks Kamal Haasan to join politics
Photos: TV actress who played goddesses on the small screen