By using the inner diameter distance condition we define and investigate new, in such a generality, class {mathcal {F}} of homeomorphisms between domains in metric spaces and show that, under additional assumptions on domains, {mathcal {F}} contains (quasi)conformal, bi-Lipschitz and quasisymmetric mappings as illustrated by examples. Moreover, we employ a prime ends theory in metric spaces and provide conditions allowing continuous and homeomorphic extensions of mappings in {mathcal {F}} to topological closures of domains, as well as homeomorphic extensions to the prime end boundary. Domains satisfying the bounded turning condition, locally and finitely connected at the boundary and the structure of prime end boundaries for such domains play a crucial role in our investigations. We apply our results to show the Koebe theorem on arcwise limits for mappings in {mathcal {F}}. Furthermore, relations between the Royden boundary and the prime end boundary are presented. Our work generalizes results due to Carathéodory, Näkki, Väisälä and Zorič.