Left-armer Herath removed Dwayne Bravo, Sulieman Benn and Carlton Baugh as the West Indies were bowled out for 243 in their first innings just before tea in reply to Sri Lanka's 387-9 declared.
Sri Lanka declared in their second innings on 57-1, with Tharanga Paranavitana scoring 20 not out and skipper Kumar Sangakkara one not out.
Opener Tillakaratne Dilshan (26) was the lone batsman to be dismissed, caught behind off Bravo.
The West Indies, set an improbable 202-run target off 21 overs, lost openers Chris Gayle (three) and Adrian Barath (eight) before reaching 12-2 in their second innings when play was called off due to bad light.
Spinner Ajantha Mendis trapped Barath leg-before and part-time spinner Dilshan had Gayle caught by former captain Mahela Jayawardene at first slip.
The three-Test series is tied 0-0 after the drawn matches in Galle and Colombo.
The final Test starts in Pallekele on Wednesday.
West Indies wicketkeeper Baugh earlier hit six fours in his second Tes