Jason Holder took 4-21 in the final session to give West Indies hope of wrapping up a series win against Sri Lanka after a remarkable 20-wicket day in Bridgetown.
Sri Lanka started day three on 99-5 in their first innings and ended it on 81-5 in their second, chasing 144 to level the series.
The Windies were skittled for 93 in their second innings to hold a slender lead, but Holder's spell put the hosts in control, with Kusal Perera a doubt for day four having picked up an injury.
Earlier in the day, Niroshan Dickwella's gritty 42 was not enough to give Sri Lanka a lead after the first innings, as Shannon Gabriel and Holder cleaned up the tail.
It gave West Indies a 50-run lead gong into their second knock, but they slumped to 14-5 after three wickets from Suranga Lakmal in the first eight overs.
Kemar Roach (23) top scored for the hosts, who limped to 93 thanks to Shane Dowrich (16), Holder (15) and Miguel Cummins (14), giving them a lead of 143.
Sri Lanka got to 30-1 in the chase before Holder ripped through the visitors' top order to leave them still needing another 63 runs with five wickets remaining.
West Indies lead the three-match series 1-0 after two Tests.