Dilshan opened with 101 for his 13th test century and Sangakkara was 111 not out at stumps having posted his 29th hundred.
Sangakkara was involved in two century partnerships; he and Dilshan shared 124 for the second wicket, then he and captain Mahela Jaywardene, unbeaten on 55, compiled an unbroken stand of 113.
Pakistan offspinner Saeed Ajmal, who tormented England at the start of the year, claimed both wickets in finishing the day with 2-81.
Ajmal had opener Tharanga Paranavitana stumped for 24 at 63-1. That gave wicketkeeper Adnan Akmal his 50th dismissal in test cricket.
Dilshan reached his half-century off just 49 deliveries, but he knuckled down for almost four hours to complete his hundred in the afternoon session, sweeping left-arm spinner Abdur Rehman for his 13th boundary.
Dilshan had gone 11 tests without a century since posting the highest individual score by a Sri Lankan at Lord's, where he made 193 in 2011.
He was dismissed in the penultimate over before tea when Ajmal trapped him leg before wicket. His second century against Pakistan lasted 180 balls, and included one six.
Sangakkara reached three figures when he pushed Ajmal for a single to mid-off. His chanceless knock, at 194 balls, contained 13 fours.
His eighth century against Pakistan tied the record for most hundreds against Pakistan with compatriot Aravinda de Silva.
Pakistan opted for the second new ball in the 85th over in a bid to get the breakthrough, but the Sri Lanka batsmen survived the five-over spell to stumps.
Jayawadene, who elected to bat first after winning the toss, was unbeaten on 55 having hit eight fours.
Sri Lanka was forced to leave out seamer Chanaka Welegedara, who had a sore shoulder. Nuwan Pradeep Fernando, who made his debut last year against Pakistan in the United Arab Emirates, returned to the side in Welegedara's place.
Pakistan was without captain Misbah-ul-Haq, who was suspended after Pakistan maintained a slow over rate in the two-wicket loss to the hosts in the fifth one-dayer in Colombo. Mohammad Hafeez led the side while Mohammad Ayub, a 32-year-old middle-order batsman made his debut.