Sri Lanka has a comfortable 333-run lead and should feel happy as no team has chased that many to win a test match at this ground. The highest successful run chase in Galle is 268 for four by Sri Lanka against New Zealand in 2019.
Former captain Chandimal, who was top scorer with 76 runs in the first innings, was a thorn in Pakistan's flesh again stitching vital partnerships with the tail. He brought up his 23rd half-century with a single to covers off Naseem Shah.
Chandimal closed the day with five fours and two sixes from 121 deliveries. Prabath Jayasuriya was on four.
The 32-year-old Chandimal has been in good nick having posted a maiden double hundred against Australia last week as Sri Lanka went onto record a come from behind against the world's top-ranked team.
Pakistan had an opportunity to dismiss Chandimal when he was on 68 but Hasan Ali put down a return catch. Pakistan also unsuccessfully reviewed a leg-before shout against him.
The game was evenly poised when the day began with Sri Lanka having a lead of 40 runs with nine wickets in hand. Pakistan knocked off night-watchman Kasun Rajitha early in the second over of the morning but a 91-run stand for the third wicket between Kusal Mendis (76) and Oshada Fernando (64) steadied the innings.
However, after lunch, Pakistan claimed a few quick wickets to bounce back.
Yasir Shah dismissed Kusal Mendis with a ball that pitched well outside the leg-stump and then turned sharply and knocked top of off-stump beating the batsman's defence. The leg-spinner has taken five wickets in his comeback game.
Left-arm orthodox spinner Mohammad Nawaz was the pick of the bowlers for Pakistan picking up a maiden five-wicket haul in the second innings.
At 235 for seven, Pakistan were looking to keep Sri Lanka's lead below 250, but yet again the tail hurt them.
Ramesh Mendis (22) added 32 runs with Chandimal for the eighth wicket while Maheesh Theekshana (11) added 41 runs for the ninth wicket to take Sri Lanka's lead beyond 300 and make things almost impossible for the tourists. They were not done yet as number 11 Prabath Jayasuriya added a further 21 runs for the last wicket with Chandimal.
Play was called off early with six overs remaining due to bad light.
The Galle wicket provided lot of assistance for spin bowlers as it usually does here. Sri Lanka have been playing lot of cricket at this venue recently having played their last five home games here and they made most of that advantage.