The opener hit one six and 11 fours in his 139-ball 119 not out for his 13th one-day hundred to boost Sri Lanka's hopes of levelling the five-match series in the day-night match in Pallekele.
Sri Lanka, who lost the opening one-dayer by six wickets on Thursday, batted steadily as Dilshan added 70 for the third wicket with Dinesh Chandimal (32) and 86 for the next with skipper Mahela Jayawardene (53).
He reached his century in the 43rd over when he pulled paceman Umar Gul for a single and then smashed fast bowler Sohail Tanvir over mid-wicket for the first six of the match.
Sri Lanka scored 56 runs in the last six overs, with Thisara Perera hitting two sixes and as many fours in his unbeaten 24 off just 14 balls.
Jayawardene was bowled by off-spinner Saeed Ajmal soon after completing his half-century, hitting eight fours in his brisk 45-ball knock.
Off-spinner Mohammad Hafeez, Tanvir and leg-spinner Shahid Afridi were the other wicket-takers for Pakistan.
Tanvir struck in his fourth over when he had opener Upul Tharanga (18) caught behind and then Hafeez held a return catch to remove Kumar Sangakkara (18) with his first delivery.
But there was no stopping Dilshan, who continued to gather runs comfortably and completed his half-century with a four off Afridi.
Pakistan made one change from the team which won the first match as they brought in debutant paceman Rahat Ali in place of injured Mohammad Sami, while Sri Lanka retained the side