Younis, who made his 100th Test appearance in the second match of the series, got to his 30th century in the day's last over. The pair have put on 217 so far for the third wicket with Younis on 101. (Source: Reuters)

Sri Lanka and Pakistan are all set for an engrossing final day of Test cricket, with Pakistan set to resume at 2-230, 147 runs short of victory.

Sri Lanka set the tourists a challenging fourth innings target of 377 with a day and a half to play, and looked to be in the box seat, when the tourists found themselves in trouble at 2-13 in the first six overs.

Ahmed Shehzad was the first to go for a duck off just three balls, when he was bowled by Lakmal. Azhar Ali followed soon after for just five to leave the tourists in a precarious position.

However Pakistan recovered to finish the day on 2-230, with Shan Masood and Younis Khan both scoring centuries.

Masood, playing just his fifth Test match, finished unbeaten on 114, with 11 fours and one six to his name.

Younis Khan notched his 30th Test century late in the day to finish on 101.

The pair have put on 217, as they look to complete a remarkable victory on day five, with the three match series currently tied at 1-1.

If Pakistan manage to win, it will be the first time in Test cricket history that an away team has scored more than 300 runs in the fourth innings of a match to win in Sri Lanka.

See the full scorecard at Cricket.com.au