A century from Shoaib Malik has helped put Pakistan on top in the final Test against Sri Lanka in Colombo.

Under fire for their poor performances in the first two Tests, Malik and Misbah-ul Haq marked a timely return to form, steering Pakistan away from the possibility of another collapse.

Malik struck an unbeaten 106 and put on 119 runs for the fifth wicket with Misbah, who had oscillated between the dour and flamboyant en route to 65.

That association helped Pakistan recover from three blows in the morning session which left them floundering at 67 for four and in danger of throwing away the advantage of a 66-run first innings lead.

Instead, the visitors reached 300 for five at stumps on the third day, a lead of 366 and with history on their side.

Sri Lanka are the only team to have chased down a target in excess of 200 in the fourth innings at the Sinhalese Sports Club ground - making 326 against Zimbabwe way back in 1998.

But the visitors pressed ahead with Malik adding 114 in an unbroken stand for the sixth wicket with Kamran Akmal (60 not out), the two holding sway at close and in a position to bat Sri Lanka out of contention for a series sweep.

The home side had begun the day in the ascendancy with the wicket of Fawad Alam almost immediately after play had resumed in the morning.

Alam added only a couple of runs to his overnight 14 before he succumbed to a strange half-pull, half-flick shot against a short-pitched delivery from left-arm paceman Thilan Thushara.

The 23-year-old Alam was hit high on the bat and presented Thushara with a simple catch and his sixth wicket in the match.

Sri Lanka then chipped away by adding the wickets of Younus Khan and Mohammad Yousuf to their bag in relatively quick time.

Younus had looked in good touch although he got off the mark with an edged boundary which flew through the slip cordon.

The Pakistan skipper went on to make 19, including three boundaries, before falling victim to a poor leg-before decision from umpire Ian Gould.

Younus had got forward to defend a delivery from Nuwan Kulasekara and was struck above the knee roll, but Gould gave him out despite the height. Television replays also showed a clear inside edge.

Pakistan were 54 for three at that stage and slipped further when left-arm spinner Rangana Herath again dismissed Yousuf.

The seasoned batsman had battled hard against his nemesis, but Herath prevailed when he induced an edge which wicketkeeper Kumar Sangakkara gloved neatly.

But Sri Lanka's success ended there.

Malik and Misbah had come together just before the lunch interval and although they had begun their innings slowly, the duo batted solidly.

Misbah was particularly laborious at the start of his innings, but accelerated nicely once he got the measure of Sri Lanka's bowlers.

On his part, Sri Lanka captain Kumar Sangakkara, who was forced to return to wicketkeeping duties due to a finger injury to Tillakaratne Dilshan, had looked tremendously short of bowling options.

Chaminda Vaas, who was brought in at the expense of Ajantha Mendis, did nothing to suggest he deserved a place in this team, while Thushara and Kulasekara had toiled hard under a relentless sun with little success.

Herath, the only bowler who looked capable of achieving a breakthrough, ended up doing the bulk of the bowling, but he achieved little.

Misbah extended the lead past the 200-run mark by clubbing Herath for a boundary and a six in one over and reached his third Test half-century by putting away a full-toss from Thushara.

Misbah fell in the final session, a victim of his own undoing. Sangakkara had turned to Angelo Mathews for the breakthrough and the all-rounder succeeded with a delivery that bounced a little more than usual.

Misbah attempted a cut, but feathered an edge to Sangakkara to the delight of Mathews, handing the home side a wicket much against the run of play.

Malik had provided solid support at the other end and reached his half-century with a single to long-off.

Sangakkara had taken the second new ball immediately it was available, but the runs flowed as Malik and Akmal stepped up the scoring rate.

Malik reached his century - only his second in Test cricket - with a massive six off Herath and went on to consolidate with Akmal at the other end.