Perovskite heterojunction engineering is the prerequisite but still a deficiency in the fabrication of micro-optoelectronic devices, where the present top-down or bottom-up techniques mainly focus on preparing the vertical heterojunction stacks. Perovskite lateral heterojunction structures generally rely on epitaxial growth, which cannot meet the demands of mass production of micro-devices. Here, a contact diffusion lithography technique is proposed to demonstrate a perovskite lateral phase heterojunction (LPH) polycrystalline film by ion-driven local phase transition. Under the guidance of thermodynamic simulations, methylamine contact and migration collectively promote in situ formation of α-phase formamidine-based perovskite patterns surrounded by δ-phase polymorphs. Spontaneous type-I heterojunction alignment between α- and δ-phases establishes energy funnels in the LPH film to facilitate carrier utilization and radiative recombination. The wide-bandgap δ-phase also serves as the coplanar isolator to achieve local anti-leakage for device integration. Based on the bright and stable LPH pattern layer, the near-infrared microscale perovskite light-emitting diode (micro-PeLED) with impressive device performance is achieved by following conventional device fabrication protocol. The proposed LPH enriches the perovskite heterojunction family, creates a new optoelectronic processing platform, and advances its versatile applications in micro-optoelectronics and photonics.