At the close of play on Day 3, Mahela Jayawardene (49 not out) had his very good friend Kumar Sangakkara (54 not out) for company as they gave Sri Lanka a healthy lead over Pakistan.

Mahela Jayawardene remained unbeaten on 49 in his farewell innings after spinner Rangana Herath's career best figures of nine for 127 gave Sri Lanka control of the second test against Pakistan on Saturday. (2nd Test, Day 3 Report | Scorecard)

Jayawardene, playing his last test, added 98 for the unbroken third wicket with his long-standing partner Kumar Sangakkara (54 not out) as Sri Lanka ended the third day against Pakistan on 177 for two wickets.

Sri Lanka, leading the two-test series 1-0, took an overall lead of 165 runs with eight second innings in hand and two days of the test match remaining.

Sangakkara and Jayawardene negotiated the Pakistan bowling, without injured Junaid Khan, skillfully on a turning track to put their team in a strong position at the end of the day.

Left-handed Sangakkara, who hit four boundaries, reached his 51st test half century before the close.

He survived a close call on 19 when Pakistan unsuccessfully reviewed a not out leg before appeal off Wahab Riaz with replays showing the ball hitting leg stump.

Pakistan were all out for 332 at the stroke of lunch, replying to Sri Lanka's first innings total of 320.

The visitors' last four wickets added 88 runs to their overnight score of 244 for six, with Sarfraz (103) moving from 66 to his hundred with a superb pulled six off Chanaka Welegedara to become the first Pakistani wicket-keeper in five years to get to three figures.

Sarfraz held the Pakistan tail together during his 127-ball innings before Herath finally had him edging a catch to wicket-keeper Niroshan Dickwella.

Sarfraz hit one six and seven fours and added 40 runs with Abdur Rehman (16) for the seventh wicket and 28 with Wahab Riaz (17) for the eighth.

Herath continued to run through the Pakistan tail picking up the wickets of Rehman, caught by Jayawardene at slip, Riaz and Saeed Ajmal (four).

Junaid, who did not take the field after being hit by a Dhammika Prasad bouncer while batting, remained unbeaten on 13.

Herath's morning spell on Saturday was four for 29 off 8.1 overs. He became only the second Sri Lankan bowler to take nine wickets in an innings after former off-spinner Muttiah Muralitharan.