Chasing 298 for victory, Pakistan rode Zaman's 76 from 91 balls (7x4, 1x6) and Ali's 74 off 67 balls (10x4) to set the tone early on as the pair added 123 for the opening wicket.
Usman Shinwari, another left-arm fast bowler from Pakistan, made a significant rise, gaining 28 slots to reach 43rd position after finishing with six wickets in the series, including a five-wicket haul that won him the player of the match award in the second ODI.
Following the series Pakistan and Sri Lanka face-off in three T20s starting in Lahore on October 5.
Earlier, the visitors rode Danushka Gunathilaka (133)'s ton to post 297/9. The first rubber was washed out without a ball bowled.
Sri Lanka won the toss and chose to bat Wednesday in the third and final one-day global against Pakistan at the National stadium in Karachi.
He was removed in the 45th over, bowled by pacer Mohammad Amir who was the best bowler for the hosts with 3/50.
Mustached comedian Rip Taylor has died at 84
Born Charles Taylor on January 13, 1935, had a tough childhood, which included being molested while in foster care. With his bushy blond toupee, exaggerated eyebrows and walrus mustache, Taylor was a striking presence.
Sohail then hit three fours and a six in a 50-ball 56 to guide the team to a win with 10 balls to spare.
Abid Ali will replace him for the third ODI, with Pakistan looking to wrap up the series which they lead 1-0 after the 67-run success on Monday.
SRI LANKA: Lahiru Thirimanne (captain), Danushka Gunathilaka, Sadeera Samarawickrama, Avishka Fernando, Oshada Fernando, Shehan Jayasuriya, Dasun Shanaka, Wanindu Hasaranga, Isuru Udana, Lahiru Kumara, Nuwan Pradeep, Angelo Perera, Minod Bhanuka, Kasun Rajitha, Lakshan Sandakan.
It will be the first time the 27-year-old Shehzad will represent Pakistan since a four-month ban for a failed dope test last year.
Former Pakistan captain Shahid Afridi has backed Babar Azam to score a double-century in ODI cricket.
The ban was further extended by six weeks after Shehzad violated rules by playing club matches despite the ban.