Azhar, Babar hit hundreds as Pakistan set Sri Lanka 476 to win
Skipper Azhar Ali and Babar Azam both completed hundreds on Sunday before Pakistan declared to set Sri Lanka a mammoth 476 to win the second and final Test in Karachi.
Azhar scored a return-to-form 118 for his 16th Test hundred while Azam smashed an unbeaten 100 as Pakistan declared at 555-3 at lunch on the fourth day with Mohammad Rizwan not out on 21.
Azam took a sharp single in the last over before lunch to complete his fourth Test hundred, and third in the last four matches, in 164 minutes with seven boundaries and a six.
It was only the second time in a Test innings that the top four in the order had all scored centuries after openers Abid Ali (174) and Shan Masood (135) on Saturday. India against Bangladesh at Dhaka in 2007 was the only previous occasion.
Pakistan will have five sessions to press for a 1-0 series win after the first Test ended in a draw due to bad weather in Rawalpindi.
Earlier, when Pakistan resumed at 395-2 Azhar smashed three boundaries off pace bowler Vishwa Fernando and then took two runs to complete his first century in 12 months.
Azhar added 148 for the third wicket with Azam as Sri Lankan bowlers toiled on a National stadium pitch which has eased out for batting.
Azhar was finally stumped off spinner Lasith Embuldeniya after 11 boundaries in his 157-ball innings.
The Test series is the first in Pakistan since terrorist attacks on the Sri Lankan team bus suspended international cricket in the country in 2009.