New Zealand faced an uphill struggle to avert a 2-0 series defeat as they closed on 182 for six, having been set a 494-run victory target by Sri Lanka on the fourth day of the second Test on Saturday.
The tourists were soon in trouble after Sri Lanka declared on 311 for five, losing both their openers Tim McIntosh (seven) and Martin Guptill (28) before tea.
Their problems deepened with Daniel Flynn (50), Ross Taylor (27), Brendon McCullum (13) and Jess Ryder (38) all being dismissed before the close.
Herath was the chief wicket-taker for Sri Lanka, with four for 73 from 21 overs.
All rounder Jacob Oram was unbeaten on seven at stumps with captain Daniel Vettori on five, New Zealand still needing another 312 runs.
Earlier, Sangakkara led from the front with a stylish 109, his 20th Test century.