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.
WIvSL: Shannon Gabriel dismissed Roshen Silva for his fifth wicket in the @OfficialSLC to become 1st @westindies bowler to take 10 wkts in a Test vs this opponent #Congratulations pic.twitter.com/dhCy0RpZDs— CricketWestIndies (@westindies) June 17, 2018
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.
|Federer, Zverev help Europe defend Laver Cup|
|I couldn´t sit or stand – Tiger Woods reflects on back woes after ending drought|
|Snead´s record in sight – Tiger Woods´ 80 PGA Tour wins|
|Nicklaus, Magic Johnson, McIlroy and Kane – Sports stars celebrate Tiger´s Tour win|
|Tiger Woods season in review: Tour Championship win caps remarkable comeback|
|49ers fear QB Garoppolo suffered torn ACL|
|World of golf is proud of Woods – Rose|
|WATCH: Tiger followed by incredible sea of fans at East Lake|
|Three takeaways from the 2017-18 PGA Tour season|
|Mbappe shows off signed Pele shirt|
|Tiger timeline: Woods´ fall and rise|
|Spieth´s breakthrough, Garcia´s Masters moment - Events between Tiger´s triumphs|
|Tiger Woods: I was close to tears on the last hole|
|Woods earns first win since 2013; Rose claims FedEx Cup|
|Pogba implores Manchester United to ´attack, attack, attack´|
|Valverde, Busquets and Vidal criticise Lenglet dismissal|
|Tiger Woods: The stunning statistics|
|Fitness hindering Dybala form, says Allegri|
|BREAKING NEWS: Woods claims first title since 2013, Rose wins FedEx Cup|
|Povetkin struggles leave Joshua with no Wilder fear|
|Guardiola targets Barca, Bayern dominance with Premier League priority|
|Centurions Rohit and Dhawan put India in final|
|Eagles top Colts as Wentz makes his return|
|Barcelona 2 Girona 2: Stuani brace punishes Lenglet red|
|Frosinone 0 Juventus 2: Ronaldo redeemed as champions extend perfect start|
|Gattuso: No alibis for two-faced AC Milan|
|Bangladesh hold on despite late Afghanistan charge|
|Composed Woods hits turn with five-shot lead|
|Chiefs´ Mahomes has another record-breaking Sunday|
|Saints QB Drew Brees passes Brett Favre for most career completions|
|Emery hints Leno may need patience after Cech display|
|Picamoles scores four as Montpellier batter 14-man Toulouse|
|Messi breaks LaLiga record|
|Worcester fend off prowling Tigers, Sarries go top|
|AC Milan 2 Atalanta 2: Last-gasp Rigoni rescues a point|
|Neymar keen to repay supporter affection|
|Pellegrini rues West Ham´s wastefulness|
|Paris Saint-Germain´s positive response buoys Tuchel|
|Lewis rekindles fond memories with Vilamoura triumph|
|Arsenal 2 Everton 0: Lacazette, Aubameyang extend winning streak|
|Stephens suffers as Osaka withdraws in Wuhan|
|Rhinos run riot to secure Super League status|
|Risk brings reward for victorious Marquez|
|Let´s have some fun - Wentz tweets message to Eagles fans ahead of return|
|Maybe in a year Chelsea will be at Liverpool´s level – Sarri|
|Under-pressure Rodgers bemoans ´bitty´ Celtic start|
|Slater should be banned for Grand Final - Fittler|
|Simon ends Bachinger fairytale to lift Metz title|
|Dominant Thiem reigns in St. Petersburg|
|Neymar hands young fan his shirt during Paris Saint-Germain victory|
|Quick-Step Floors storm to fourth time trial gold|
|Jorginho sets new passing record in West Ham draw|
|Rubiales slams ´crazy´ LaLiga schedule|
|Rennes 1 Paris Saint-Germain 3: Tuchel´s Ligue 1 record stays perfect|
|Why so serious? Joshua reveals Fury has blocked him on Twitter|
|West Ham 0 Chelsea 0: Sarri´s 100 per cent start comes to frustrating end|
|Marvellous Marquez reigns in Aragon yet again|
|Real Madrid will not go to the USA with LaLiga - Perez|
|Erasmus adds five players to Springboks squad|
|Barcelona snub ´hardest decision´ of Griezmann´s career|
|Perez pays tribute to Ronaldo and Zidane|
|Cazorla concedes Arsenal lacked self-belief under Wenger|
|Get King Kong for AJ! Joshua understands critics´ demands|
|Korea change sees Bertens take title in Seoul|
|I love Bilic, but I let him down – Arnautovic|
|He will never fight me! Fury hits out at ´ponderous´ Joshua|
|Azpilicueta convinced Hazard can be ´the best´|
|Wigglesworth´s career in Opta numbers as he breaks Premiership record|
|Ronaldo has nothing to prove, says Allegri|
|Federer shines as Europe hold narrow lead at Laver Cup|