Thilan Samaraweera's half century was part of a defiant Sri Lanka fightback on the third day of the second Test with New Zealand in Colombo.