Chandimal finished with 64 not out off 70 balls and added a match-turning 40 runs for the ninth wicket with Ajantha Mandis (19 not out) to see Sri Lanka through with two balls to spare.
Mendis hit the winning boundary and smashed one of the two sixes in Umar Gul's penultimate over which cost Pakistan 15 runs and the match.
Chandimal hit his only boundary to reach fifty before hitting a six off Gul to clinch an unlikely win after Sri Lanka had wobbled at 195-8, derailed by Junaid Khan (3-31) and Saeed Ajmal (2-43).
Sri Lanka, who chased down a 285-run target in their second one-day win in Dubai, were cruising along at 113-1 after Kusal Perera (47) and Tillakaratne Dilshan (45) gave them a brisk start of 75.
Perera was aggressive right from the word go, hitting four sixes and three boundaries in his 40-ball knock, but was trapped leg-before by Mohammad Hafeez after he attempted a reverse sweep.
When on 31, Dilshan completed 8,000 one-day runs, becoming the sixth Sri Lankan to achie