Opener Dimuth compiled a brilliant century to put Sri Lanka in a commanding position at 3-254 on the opening day of the second day-night Test in Dubai on Friday.
Karunaratne was unbeaten on 133, adding 118 for an unbroken fourth-wicket stand with skipper Dinesh Chandimal (49 not out) after Sri Lanka won the toss and batted on a flat Dubai Stadium pitch.
The left-hander batted with authority and style to reach his seventh Test hundred off 197 balls, hitting Mohammad Amir for two consecutive boundaries to complete three figures.
He batted for 381 minutes, hitting 15 fours and a six.
Karunaratne fell seven runs short of a hundred in the first Test in Abu Dhabi where Sri Lanka won by 21 runs to take a 1-0 lead in the two-match series.
Chandimal followed his 155 not out in the opening Test with another confident innings, collecting five boundaries as the Sri Lankan pair blunted Pakistan's bowling attack.
"It's satisfying to score a hundred," said Karunaratne, who needs just 10 more to reach 3,000 Test runs. "I missed that chance in Abu Dhabi. It was tough to bat early on, but once I had my eyes set in I batted with confidence.
"It was nice to have a good partnership with Chandimal and that has given us a good score which we need to build on tomorrow."
Pakistan took the second new ball after 82 overs but failed to claim any further wickets, with Amir walking off the field shortly before the close with a shin injury that bowling coach Azhar Mahmood said was being closely monitored.
"He is still under observation," said Mahmood. "Hopefully nothing serious. Because the pitch was really hard, Amir is feeling some pain in his left shin."
Pakistan, who have never lost a Test series in the United Arab Emirates, also wasted both their reviews off the second new ball to cap a woeful day for them.
Leg-spinner Yasir Shah was the pick of bowlers with 2-90 while Amir returned figures of 1-59.
Karunaratne and opening partner Kaushal Silva (27) provided a solid platform for Sri Lanka with a 63-run stand before Pakistan hit back with three wickets in quick succession.
Yasir delivered the much-needed breakthrough for his team when he had Silva caught behind off a short delivery.
Debutant Sadeera Samarawickrama impressed during his quick-fire 38, smacking five fours and a six before he miscued a pull and was caught and bowled by Amir.
Kusal Mendis played a rash drive off Yasir and was caught in the slips for one.
Karunaratne crunched three boundaries in an Amir over and then hit Yasir for another to reach his sixth Test fifty.
Sri Lanka made two changes from the first Test, leaving out Lahiru Thirimanne and Lakshan Sandakan for Samarawickrama and paceman Lahiru Gamage while Pakistan brought in fast bowler Wahab Riaz in place of the unfit Hasan Ali.
This is the sixth day-night Test with a pink ball since Australia and New Zealand played the first such contest at Adelaide in December 2015.