At one stage, Sri Lanka were tottering on 163 for seven but an unbroken 47-run partnership for the eighth wicket between Kusal Mendis and Maheesh Theekshana saw them through.