Zimbabwe were seven wickets away from their maiden Test win over Sri Lanka on Monday after setting the hosts a target of 388 in their one-off match at the R. Premadasa Stadium.
Sri Lanka were 3-170 in their second innings at stumps on the fourth day, still needing another 218 to beat Zimbabwe, who also recently won their maiden one-day international series against the hosts.
Kusal Mendis was unbeaten on 60 with Angelo Mathews, who stepped down as captain after the ODI series defeat, on 17 not out.
Zimbabwe captain Graeme Cremer picked up 2-67 in Sri Lanka's second innings to add to his five-wicket haul in the first innings.
Earlier, Sikandar Raza's first Test century helped Zimbabwe to 377 in their second innings after the touring side had resumed the fourth day on 6-252.
Raza scored 127 and added 144 for the seventh wicket with Malcolm Waller, who made 68, to ensure his side set Sri Lanka a steep target to chase.
Sri Lanka spin spearhead Rangana Herath picked up 6-116 - his 31st five-wicket haul in Tests - to total 11 wickets in the match.