New Zealand were one batsman short after Corey Anderson suffered a finger injury and finished 60 for nine after 15.3 overs.
Brendon McCullum, Ross Taylor and Jimmy Neesham all feel for ducks to Herath as the Black Caps slumped to 33 for six. Williamson and Kyle Mills started somewhat of a revival, in the smallest sense of the word, putting on 18 for the seventh wicket before New Zealand's final three wickets fell in quick succession.
Earlier, Trent Boult and Neesham claimed three wickets apiece to bowl Sri Lanka out for a moderate total. Mahela Jayawardene made 25 while Lahiru Thirimanne scored 20.
"It was a bit dry than we expected and Herath and Sachi [Sachithra Senanayake], the way they bowled was outstanding. They blew us away with about eight wickets for some 10 runs," Black Caps skipper Brendon McCullum said after the defeat.
"We just didn't adapt ourselves and played some mindless cricket. We took some poor options and as a result of that we're on the plane home".
It is the fourth straight time New Zealand have failed to make the semifinals at an Twenty20 World Cup, having only reached the final four at the inaugural event in 2007.
Sri Lanka will face either Pakistan or West Indies in the semifinals. India will play South Africa in the other semifinal.
SCOREBOARD
Sri Lanka innings
K Perera c Ronchi b Boult 16
T Dilshan c Ronchi b Boult 8
M Jayawardene b N McCullum 25
K Sangakkara c Anderson b Boult 4
L Thirimanne c Guptill b Neesham 20
A Mathews c Ronchi b McClenaghan 6
T Perera c Williamson b Mills 16
N Kulasekara c N McCullum b McClenaghan 0
S Senanayake c Williamson b Neesham 17
R Herath not out 1
L Malinga b Neesham 0
Extras (2lb 3w 1nb) 6
Total (all out, 19.2 overs) 119
Fall: 1-20 (K Perera), 2-29 (Dilshan), 3-35 (Sangakkara), 4-65 (Thirimanne), 5-81 (Mathews), 6-85 (Jayawardene), 7-92 (Kulasekara), 8-116 (T Perera), 9-119 (Senanayake), 10-119 (Malinga).
Bowling: K Mills 4-0-30-1, T Boult 4-0-20-3 (1w 1nb), C Anderson 3-0-13-0 (1w), M McClenaghan 4-0-24-2 (1w), J Neesham 2.2-0-22-3, N McCullum 2-0-8-1.
New Zealand innings
M Guptill run out (Herath) 5
K Williamson run out (Mathews) 42
B McCullum st Sangakkara b Herath 0
R Taylor lbw b Herath 0
J Neesham b Herath 0
L Ronchi lbw b Herath 2
N McCullum c Mathews b Senanayake 2
K Mills lbw b Senanayake 4
T Boult c Jayawardene b Herath 3
M McClenaghan not out 0
C Anderson (absent hurt) 0
Extras (2w) 2
Total (9 wkts, 15.3 overs) 60
Fall: 1-18 (Guptill), 2-18 (B McCullum), 3-23 (Taylor), 4-23 (Neesham), 5-29 (Ronchi), 6-33 (N McCullum), 7-51 (Mills), 8-60 (Williamson), 9-60 (Boult).
Bowling: N Kulasekara 3-0-15-0 (2w), A Mathews 4-0-26-0, R Herath 3.3-2-3-5, L Malinga 2-0-13-0, S Senanayake 3-0-3-2.
Result: Sri Lanka won by 59 runs.