Root (nine not out) and Ali (22 not out) survived more than an hour's play today to take England to 83 for five -- still needing a further 267 runs to reach their victory target of 350 -- before rain at 12:11pm (1111 GMT) led to an early lunch on the fifth day.
England resumed on 57 for five, having collapsed in the face of paceman Dhammika Prasad's sensational burst of four wickets for 15 runs yesterday.
England needed to surpass their 86-year-old highest fourth innings record total to win of 332 for seven against Australia at Melbourne in 1928 if they were to record a sensational victory.
It was all a far cry from when England were 311 for three after tea on the second day of this Test, thanks to Australia-born opener Sam Robson's maiden Test century, and even when they reduced Sri Lanka to 277 for seven on Monday -- a lead of just 169.
But all-rounder Mathews went on to make a superb Test-best 160, the all-rounder's putting on 149 with the admirable Herath (48).