The inner ear morphology of 80 snake and lizard species, representative of a range of ecologies, is here analysed and compared to that of the fossil stem snake Dinilysia patagonica, using three-dimensional geometric morphometrics. Inner ear morphology is linked to phylogeny (we find here a strong phylogenetic signal in the data that can complicate ecological correlations), but also correlated with ecology, with Dinilysia resembling certain semi-fossorial forms (Xenopeltis and Cylindrophis), consistent with previous reports. We here also find striking resemblances between Dinilysia and some semi-aquatic snakes, such as Myron (Caenophidia, Homalopsidae). Therefore, the inner ear morphology of Dinilysia is consistent with semi-aquatic as well as semifossorial habits: the most similar forms are either semi-fossorial burrowers with a strong affinity to water (Xenopeltis and Cylindrophis) or amphibious, intertidal forms which shelter in burrows (Myron). Notably, Dinilysia does not cluster as closely with snakes with exclusively terrestrial or obligate burrowing habits (e.g. scolecophidians and uropeltids). Moreover, despite the above similarities, Dinilysia also occupies a totally unique morphospace, raising issues with linking it with any particular ecological category.