Sri Lanka set Pakistan 377 to win Test and series