Sri Lanka hit back after Shaheen takes four wickets in first Test
All-rounder Salman Ali Aghan makes Test debut for Pakistan
Stay tuned with 24 News HD Android App
The tourists reached 24 for two at the close of play in Galle after losing their openers Imam-ul-Haq and Abdullah Shafique.
Azhar Ali, on three, and skipper Babar Azam, on one, were batting at close of play with Pakistan still trailing by 198 runs.
Fast bowler Kasun Rajitha trapped Imam leg before wicket for two and Prabath Jayasuriya took down Shafique for 13 with his left-arm spin on a day dominated by the bowlers.
Left-arm fast bowler Shaheen stood out with figures of 4-58 but Dinesh Chandimal's attacking 76 and a late cameo of 36 by Maheesh Theekshana gave the hosts a fighting total on a pitch expected to aid spinners.
"That's the beauty of Test cricket, sometimes tailenders and sometimes lower-order batsmen look like proper batsmen," Shaheen told reporters.
"We to get them out under 150-160, but the last few batsmen played well. Chandimal played well."
The hosts were tottering at 133-8 but added 89 runs for the final two wickets including a 44-run stand by Theekshana and Chandimal, who hit 10 fours and one six.
Shaheen wrapped up the innings with the wicket of Theekshana in the final session of play.
"They bowled really well," said Chandimal. "What we need to do is to get the positives from this innings and take it to the next innings."
Chandimal, a former captain, said early wickets will decide the course of the match on Sunday's day two and a lead of about 40 can make the hosts gain more ground.
Shaheen struck in the third over of the day to send back skipper Dimuth Karunaratne for one, and leg-spinner Yasir Shah soon combined with the quick bowlers to have Sri Lanka in trouble after they elected to bat.
Oshada Fernando and Kusal Mendis attempted to rebuild the innings in a 49-run partnership but Yasir, who is making a comeback to the team after a thumb injury that kept him out since August last year, broke through.
Yasir got Kusal caught behind for 21 and Oshada soon followed his partner back to the pavilion in the next over when pace bowler Hasan Ali cut short the opener's stay on 35.
Angelo Mathews then fell for a 15-ball duck as Yasir got the former captain caught at mid-on.
"He's a very good bowler," said Chandimal. "We had a plan for him. We are not going to give him too much respect either."
Shaheen struck twice after lunch and fellow quick Naseem Shah and left-arm spinner Mohammad Nawaz took a wicket each.
Chandimal smashed 19-year-old Naseem for three straight boundaries to bring up his fifty and offer some cheer to the weekend crowd.
Chandimal, who made an unbeaten 206 in Sri Lanka's series-levelling Test win over Australia earlier this week, finally fell to a good catch by Yasir at cover with Ali taking his second wicket.
But Theekshana played a defiant knock in just his second Test and put on 45 runs for the last wicket with Rajitha, unbeaten on 12.
A new player Salman Ali Agha also got a Test cap from legendary Pakistan batter and batting coach Muhammad Yousaf.
The two teams have a history of producing compelling cricket and we shouldn't expect anything short of a cracker. They last met in Tests in December 2019, a series the hosts took one-nil after all of Pakistan's top four made hundreds.
Sri Lanka 1st innings
O. Fernando c Rizwan b Ali 35
D. Karunaratne b Shaheen 1
K. Mendis c Rizwan b Yasir 21
A. Mathews c Naseem b Yasir 0
D. Chandimal c Yasir b Ali 76
D. de Silva b Shaheen 14
N. Dickwella c Agha b Shaheen 4
R. Mendis c Rizwan b Naseem 11
P. Jayasuriya lbw b Nawaz 3
M. Theekshana c Rizwan b Shaheen 38
K. Rajitha not out 12
Extras (b1, lb3, nb3) 7
Total (all out, 66.1 overs) 222
Fall of wickets: 1-11 (Karunaratne), 2-60 (K. Mendis), 3-60 (Oshada), 4-68 (Mathews), 5-99 (de Silva), 6-103 (Dickwella), 7-130 (R. Mendis), 8-133 (Jayasuriya), 9-177 (Chandimal), 10-222 (Theekshana)
Bowling: Shaheen 14.1-3-58-4, Ali 12-2-23-2, Naseem 13-0-53-1 (nb3), Yasir 21-4-66-2, Nawaz 6-2-18-1
Pakistan 1st innings
A. Shafique lbw b Jayasuriya 13
Imam-ul-Haq lbw b Rajitha 2
A. Ali not out 3
B. Azam not out 1
Extras (w5) 5
Total (2 wickets, 18 overs) 24
Fall of wickets: 1-12 (Imam-ul-Haq), 2-21 (Shafique)
Match Referee: Jeff Crowe (NZL)