At lunch Pakistan were 121-2 after both openers were removed, with Azhar Ali unbeaten on five and Asad Shafiq on one with Pakistan still 298 runs behind Sri Lanka's first innings total of 419.
Masood struck a confident 59 while Aslam made 51 in a solid stand of 114 before the Sri Lankan spinners Dilruwan Perera and Rangana Herath put the brakes on the innings.
Aslam, recalled after being dropped from the West Indies tour on disciplinary grounds earlier this year, was trapped leg-before by off-break bowler Perera. He hit four boundaries in his seventh Test half century.
Both Ali and Shafiq survived confident appeals. Ali wisely reviewed a leg-before decision off Perera, but the ball hit his bat before the pad.
Shafiq was given not out on a review when he was stumped off Herath on one.
Disclaimer: No Business Standard Journalist was involved in creation of this content