Pakistan opener Shoaib Malik ground out an undefeated 148, his maiden Test century, to save the first Test against Sri Lanka on Thursday.
Malik frustrated Sri Lanka's bowlers throughout the final day and Pakistan, set an improbable 458-run victory target, were 337 for four when the captains agreed to call off the game seven overs before the close.
The 24-year-old all rounder's eight-hour innings, an exhibition of patience, self-control and concentration, spanned 369 balls and included 21 fours and two sixes.
For the majority of the day he stuck rigidly to a defensive plan, relaxing only in the final half hour when he celebrated Pakistan's escape with a flurry of boundaries, including two straight sixes off Muttiah Muralitharan.
Middle order batsman Faisal Iqbal (60) gave solid support during a 115-run third wicket partnership spanning 193 minutes. Skipper Inzamam-ul-Haq also provided stout resistance with 48, adding 81 for the fourth wicket.
The second and final Test starts in Kandy on Monday.
Resuming at 89 for two, Pakistan were helped by an 81-minute interruption due to bad light and drizzle during the morning.
Malik and Iqbal survived the morning and early afternoon without major alarm on a pitch that grew increasingly placid.
Even off-spinner Muralitharan was handled with relative ease and skipper Mahela Jayawardene used seven bowlers to try and conjure up a breakthrough.
The hosts finally found success with the second new ball, which was taken immediately it became available at 179 for two.
All-rounder Farveez Maharoof, Sri Lanka's best bowler in the game, nipped a delivery back to trap Iqbal lbw.
Malik, dropped on 14 the previous evening, should also have been given out lbw on 70 after a missing a full-length Maharoof inswinger.
The right-hander's good fortune continued in the final session as umpire Rudi Koertzen missed an edge off left-armer spinner Sanath Jayasuriya when he was on 94.
Muralitharan had Inzamam snapped up at silly point but it was too late for Sri Lanka to force a result.
Muralitharan was Sri Lanka's most successful bowler, toiling hard for his three for 94 from 42 overs.
Sri Lanka (1st innings): 185 (T. Dilshan 69; M. Asif 4-41)
Pakistan (1st innings): 176 (I. Farhat 69; F. Maharoof 4-52)
Sri Lanka (2nd innings): 448 for 5 decl (K. Sangakkara 185, M. Jayawardene 82, U. Tharanga 72, T. Samaraweera 64).
Pakistan (2nd innings): (Overnight: 89-2; Target: 458 runs)
S. Malik not out 148
I. Farhat c Jayawardene b Muralitharan 34
Y. Khan b Muralitharan 8
F. Iqbal lbw Maharoof 60
Inzamam-ul-Haq c Dilshan b Muralitharan 48
A. Razzaq not out 20.
Extras: (b-6, lb-7, nb-5, w-1) 19.
Total: (for 4 wickets, 121 overs) 337
Fall of wickets: 1-59, 2-71, 3-186, 4-267
Did not bat: U. Gul, D. Kaneria, M. Asif, K. Akmal, S. Afridi
Bowling: L. Malinga 13 - 3 - 44 - 0, F. Maharoof 23 - 8 - 70 - 1 (nb-4), M. Muralitharan 42 - 13 - 94 - 3 (nb-1), D. Fernando 15 - 3 - 40 - 0 (w-1), M. Bandara 14 - 4 - 35 - 0, S. Jayasuriya 13 - 3 - 37 - 0, T. Dilshan 1 - 0 - 4 - 0.