Mohammad Nawaz, an all-rounder who bowls left-arm spin, returned figures of 5-88 after taking his maiden five-wicket haul on Monday, while fellow spinner Yasir Shah took three wickets.
The Pakistan spinners had reduced Sri Lanka to 235-7 but Chandimal hit back with his second half-century of the match and got help from the tail to hand the tourists a challenging target.
Chandimal, who hit 76 in Sri Lanka's first innings total of 222, put on key partnerships including a 41-run ninth-wicket stand with Maheesh Theekshana.
Opener Oshada Fernando (64) and Kusal Mendis (76) also struck key knocks, putting on 91 runs for the third wicket to add to Sri Lanka's dominance on a turning pitch.