Batting first after winning the toss, Pakistan made 316 in 50 overs. In reply, Sri Lanka was dismissed for 181 in the 42nd over.
Pakistan leads the five-match series 2-1.
Shah completed his 10 overs with 4-29, backing up good contributions from Pakistan's top and middle order with the bat — including half-centuries from Sarfraz Ahmed (77) and Mohammad Hafeez (54).
Shah's figures in his eighth one-day game surpassed his previous best of 2-40 against Zimbabwe last May.
Left-arm spinner Imad Wasim, who made his debut for Pakistan, and seam bowler Anwar Ali took two wickets each.
Sri Lankan No. 3 batsman Lahiru Thirimanne was the only standout performer for Sri Lanka with 56 runs.
Pakistan captain Azhar Ali praised his batsmen and his bowlers for being able to dismiss hard-hitting Kusal Perera and Tillakaratne Dilshan.
Perera equaled the second fasted fifty in ODIs in 17 deliveries in the second match, helping Sri Lanka win by two wickets.
"We were careful ... in the first 10 overs. We didn't want to leak the runs the way we did in Pallekele," Azhar said. "The bowlers did a very good job and stuck to their plans. We got two wickets, Dilshan and Perera, that really helped us in the game."
Sri Lanka captain Angelo Mathews said a lack of aggression had cost his side the match.
"If Kusal and Dilshan were able to bat the way they do, we could have scored 60 to 70 runs in the first 10 overs. Unfortunately both of them got out," Mathews said. "Chasing 316, every batsman needed to take a calculated risk every over. Everyone tried to do that and most of them failed."
Anwar Ali provided the breakthrough for Pakistan, dismissing Dilshan for 14 — caught by Azhar at mid-off with the total on 33.
Nine runs later Anwar claimed the key wicket of Perera caught by wicketkeeper Ahmed for 20.
Then Shah entered the hunt, having Upul Tharanga stumped for 16, Mathews caught in the deep by Shoaib Malik for four and Thisara Perera (20) and Sachith Pathirana (19) caught by Anwar in the deep.
With Sri Lanka on 158-7, clashes erupted among local spectators and play was suspended for about 30 minutes to allow police to empty the stands.
Players were called into the middle of the pitch for safety and later they went off the field. Play resumed before near-empty stands.
Earlier, Pakistan opted to bat and No. 4 batsman Ahmed made 77 off 74 deliveries, including seven boundaries, while Hafeez made 54 with four fours to lead Pakistan to a formidable score.
All of Pakistan's top and middle order batsmen backed up the decision to bat first with useful contributions.
Azhar and Ahmed Shehzad shared 93 for the first wicket off just 99 deliveries before Shehzad was out for 44, caught by Pathirana off fast bowler Lasith Malinga.
Azhar was run out on 49 while trying to take a second run with Hafeez. He faced 59 deliveries and hit four boundaries.
Hafeez was caught by Kusal Perera off left-arm spinner Pathirana after his 64-ball innings.
Malik and Mohammad Rizwan launched a late assault as Pakistan scored 93 runs in the last 10 overs, including 21 off the last over bowled by Malinga who conceded 80 runs in his 10 overs.
Malik was unbeaten on 42 in 29 deliveries while Rizwan made 35 not out off 22 balls, including a six and two boundaries.
Pathirana took 1-49 for Sri Lanka.
Pakistan handed a maiden ODI cap to allrounder Wasim in place of Babar Azam.
Wasim filled the vacant spin bowler's slot, following a 12-month bowling ban on off spinner Hafeez for the allrounder's illegal bowling action.
The fourth ODI will be played at the same venue on Wednesday.
Foreign Minister Paudyal discusses connectivity issue with Sri...
Play suspended amid crowd trouble in Sri Lanka vs Pakistan
Sri Lanka's third one-day international against Pakistan was interrupted for about half an hour on Sunday after fighting broke out in the stands and objects were thrown onto the field at R. Premadasa Stadium.
Chasing 317 to win, Sri Lanka was struggling at 158 for seven when play was suspended.
Players were called in to the center after an object was thrown at a Pakistan fielder and both teams later left the field as police emptied one half of the stands.
The match resumed before near-empty stands.