Sri Lanka bowled Pakistan out for 110 and chased the target down in 18.1 overs at the Gaddafi Stadium in Lahore on Tuesday, winning by eight wickets to book a place in Saturday's tri-series final.
It was the fifth match of the tri-series, which also features England and is being played across Pakistan.
Left-arm quick Dilshan Madushanka took a career-best 5-34, ripping through the Pakistan middle and lower order in 8.3 overs. His previous best was 5-80 against India at the 2023 World Cup in Mumbai.
Sri Lanka captain Kusal Mendis, who won the toss and chose to field, said: "We executed our plans well and Dilshan bowled superbly."
Pakistan were bowled out in 25.3 overs for their second-lowest ODI total at home, behind only the 75 they made against Sri Lanka at the same ground in 2009.
Babar Azam top-scored for Pakistan with 29 off 33 balls, falling lbw to Eshan Malinga. The innings slid from 61-4, when Babar departed, to 91-8 when Hasan Nawaz, who made 17, was out.
Shaheen Shah Afridi struck two sixes in a quick 15 off 13 balls down the order. Maaz Sadaqat scored eight on his tri-series debut before Asitha Fernando had him out lbw.
Madushanka finished with five wickets, removing Fakhar Zaman, Saad Baig, Arafat Minhas, Haris Rauf and Shaheen Afridi, the last of those caught by Dunith Wellalage. Sahan Arachchige took 2-24, accounting for Shadab Khan and Salman Ali Agha.
Sri Lanka reached the target for the loss of two wickets in 18.1 overs. Kamindu Mendis finished unbeaten on 62 off 60 balls, with eight fours and two sixes, his fifth ODI half-century.
Pavan Rathnayake was unbeaten on 23 and Avishka Fernando made 16. Kusal Mendis was the only wicket down cheaply, bowled by Arafat Minhas for eight.
Pakistan had already secured their place in the final by winning their first three matches of the tri-series. England's last league match, against Sri Lanka on Thursday, is now a dead rubber after their elimination.
Pakistan captain Shaheen Shah Afridi said his side would regroup before the final. "We must forget this match and get ready for the final," he said. "We will come back in the final and bat stronger."
Pakistan won the tri-series opener between the two sides in Rawalpindi by 37 runs on October 18, when Salman Ali Agha scored 107. Pakistan and Sri Lanka meet again in the final at the Gaddafi Stadium in Lahore on Saturday.