Razzaq starred with the ball in the morning with his medium pace, claiming two for 19, as Sri Lanka were bowled out for a paltry 130 in 44.2 overs on a tricky two-paced pitch.
The 26-year-old then batted with a cool head and uncharacteristic caution to guide Pakistan home after the tourists had slumped to 47 for five, finishing with 41 not out from 101 balls.
Razzaq was supported in the run chase by Mohammad Yousuf (26), with whom he added 35 in 16 overs, and later with wicketkeeper Kamran Akmal (20 not out) with whom he shared an unbroken seventh-wicket stand worth 52 runs.
Pakistan had appeared set for an easy win after winning the toss and bowling an injury-hit Sri Lanka team out cheaply, but were forced to chisel out their runs as the Sri Lankan bowlers and fielders applied pressure throughout the run chase.
Shahid Afridi (two), promoted up the order, triggered Sri Lanka's comeback when he skied a catch trying to blast a good length delivery from Lasith Malinga straight down the ground.
Opener Salman Butt (four) was also dismissed just before the luncheon interval, brilliantly caught by a diving Kumar Sangakkara behind the stumps, to leave Pakistan wobbling on 16 for two.
INITIATIVE SWING After the break Russel Arnold ran out Younis Khan (four) with a direct hit and Malinga nipped a ball back to trap Inzamam ul Haq (one) lbw.
When Mahela Jayawardene, stand-in captain in the absence of Marvan Atapattu (back injury), pouched a brilliant low slip catch to dismiss Shoaib Malik the initiative swung the home team's way for the first time in the match.
But Yousuf and Razzaq consolidated the innings with a risk-free approach, concentrating on survival and the slow accumulation of singles.
Earlier, middle order batsman Tillakaratne Dilshan was responsible for saving Sri Lanka from major embarrassment having collapsed to a parlous 56 for seven in the 21st over.
Dilshan top scored in the match with a gritty 48 not out from 75 balls, sharing important stands with Kulasekera and Malinga for the eighth (42) and ninth (25) wickets.
Paceman Naveed ul Hasan was Pakistan's most successful bowler, finishing with three for 23 from 6.2 overs.
The first match in the series was washed out on Friday night after a torrential downpour midway through the match.
The final game in the series has been rescheduled for Wednesday.