Epitaxial heterostructures based on oxide perovskites and III–V, II–VI and transition metal dichalcogenide semiconductors form the foundation of modern electronics and optoelectronics1,2,3,4,5,6,7. Halide perovskites—an emerging family of tunable semiconductors with desirable properties—are attractive for applications such as solution-processed solar cells, light-emitting diodes, detectors and lasers8,9,10,11,12,13,14,15. Their inherently soft crystal lattice allows greater tolerance to lattice mismatch, making them promising for heterostructure formation and semiconductor integration16,17. Atomically sharp epitaxial interfaces are necessary to improve performance and for device miniaturization. However, epitaxial growth of atomically sharp heterostructures of halide perovskites has not yet been achieved, owing to their high intrinsic ion mobility, which leads to interdiffusion and large junction widths18,19,20,21, and owing to their poor chemical stability, which leads to decomposition of prior layers during the fabrication of subsequent layers. Therefore, understanding the origins of this instability and identifying effective approaches to suppress ion diffusion are of great importance22,23,24,25,26. Here we report an effective strategy to substantially inhibit in-plane ion diffusion in two-dimensional halide perovskites by incorporating rigid π-conjugated organic ligands. We demonstrate highly stable and tunable lateral epitaxial heterostructures, multiheterostructures and superlattices. Near-atomically sharp interfaces and epitaxial growth are revealed by low-dose aberration-corrected high-resolution transmission electron microscopy. Molecular dynamics simulations confirm the reduced heterostructure disorder and larger vacancy formation energies of the two-dimensional perovskites in the presence of conjugated ligands. These findings provide insights into the immobilization and stabilization of halide perovskite semiconductors and demonstrate a materials platform for complex and molecularly thin superlattices, devices and integrated circuits.