Sri Lanka, who were 91-0 at one stage following Dilshan’s opening partnership with Mahela Jayawardene, slipped to 110-4 and then 146-6 against the steady Black Caps attack.
Nathan McCullum removed Jayawardene (46) and Kumar Sangakkara in three balls, before left-arm seamer Mitchell McClenaghan dismissed Dilshan and skipper Angelo Mathews off successive balls.
The ninth-wicket pair of Sachithra Senanayake and Rangana Herath boosted the total by smashing 18 runs in the final over, bowled by seamer Andrew Ellis.
Sri Lanka need a win to draw the series 1-1 after New Zealand won the second game in Hambantota on Tuesday. The first match was rained off.
New Zealand will round off their short two-week tour with two Twenty20 internationals in Pallekele on Tuesday and Wednesday.
S AFRICA V PAKISTAN
Three wickets in as many balls sent Pakistan tumbling from cruise control to defeat by six runs in the second Twenty20 international against series winners South Africa in Dubai on Friday.
Set 151 for victory, Pakistan were 112 for four needing 39 from 32 balls for the win, before Imran Tahir bowled Shoaib Malik (15) and Abdul Razzaq (0) in successive balls.
Wayne Parnell then had innings top-scorer Sohaib Maqsood (37) caught by wicketkeeper Quinton de Kock at the start of the next over to rock the sub-continent side.
They never quite recovered and as the run-rate slowed, South Africa were able to turn the screw. The key wicket of Shahid Afridi (14) with eight balls remaining sealed Pakistan’s fate and they ended their 20 overs on 144 for nine.
Parnell finished with three for 25 in his four overs and was ably supported by Dale Steyn (two for 20) and Tahir (two for 21).
South Africa, who claimed the two-match series 2-0, had earlier won the toss and elected to bat with their top three doing the damage.
Captain Faf du Plessis top-scored with a fine 58 not out from 48 balls that included three sixes, while Hashim Amla rediscovered his form with 48 from 41 balls.
Exciting young opener De Kock hit six fours in his 30 from 19 balls as the Proteas posted 150 for five in their 20 overs.
Saeed Ajmal was again the pick of the Pakistan bowlers with three for 25 in his four overs, while Sohail Tanvir collected two for 21 in his four.
The sides now travel to South Africa for a two-game T20 and three-match one-day international series starting on Wednesday.