West Indies quick Shannon Gabriel claimed his best match figures in a Test but Sri Lanka recovered from a poor start to move into a strong position after Dinesh Chandimal pleaded not guilty to ball tampering on day four.

Chandimal was charged for allegedly taking sweets out of his left pocket and putting them in his mouth before applying the artificial substance to the ball on Friday.

The tourists took to the field two hours later than scheduled in protest on Saturday, but went straight out into the middle on the penultimate day and recovered from 48-4 to close on 334-8 - leading by 287 as they attempt to level the three-match series in St Lucia.

Kusal Mendis top scored with a classy 87, while Niroshan Dickwella made a quick-fire 62 and Chandimal chipped in with 39 as his side showed great character to take the upper hand.

Chandimal faces a hearing at the end of the Test and has the backing of Cricket Sri Lanka following an incident which has overshadowed what has become an enthralling contest at Darren Sammy National Cricket Stadium.

Gabriel took 5-59 in the first innings and the paceman was comfortably the pick of the Windies bowlers again with 6-57, but Sri Lanka batted superbly to set up an intriguing final day.

Sri Lanka looked in danger of suffering a series defeat with a day to spare when they lost three early wickets, a probing Gabriel snaring Kasun Rajitha leg before without scoring and Dhananjaya de Silva before Mahela Udawatte slapped a Kemar Roach delivery to Devendra Bishoo at short cover.

Mendis and Chandimal set about starting a rescue mission, the skipper showing his mettle in difficult circumstances to dig in as his partner played with freedom at the other end.

The elegant Mendis hit Roach into the leg side for two sixes in an entertaining knock and Chandimal rotated the strike before edging Roach (2-75) behind. 

Mendis missed out on a deserved century when he chopped on to a delivery from the excellent Gabriel, who also removed Dickwella - but not before he had struck seven boundaries in a rapid half-century - and Roshen Silva (48), but it was very much advantage Sri Lanka at stumps.