Microscopic imaging in three dimensions enables numerous biological and clinical applications. However, high-resolution optical imaging preserved in a relatively large depth range is hampered by the rapid spread of tightly confined light due to diffraction. Here, we show that a particular disposition of light illumination and collection paths liberates optical imaging from the restrictions imposed by diffraction. This arrangement, realized by metasurfaces, decouples lateral resolution from depth-of-focus by establishing a one-to-one correspondence (bijection) along a focal line between the incident and collected light. Implementing this approach in optical coherence tomography, we demonstrate tissue imaging at 1.3 μm wavelength with ~ 3.2 μm lateral resolution, maintained nearly intact over 1.25 mm depth-of-focus, with no additional acquisition or computation burden. This method, termed bijective illumination collection imaging, is general and might be adapted across various existing imaging modalities.