Interfacial charge transfer in nanocomposites is one of the leading factors to CO2 photoreduction activity and selectivity; however, the modulation of interfacial contact still remains a compelling challenge. Here we present an in-situ assembly strategy to synthesize core–shell structured Er-UiO-66-NH2 heterojunction photocatalysts, achieving a stable CO evolution rate of 106.2 μmol·g−1·h−1 and a selectivity over 92 %. Our findings demonstrate that the coupled intermediate layer formed by solvothermal transformation creates a charge-transfer channel between Er2O3 and UiO-66-NH2, contributing to the effective spatial separation of photogenerated carriers. The well-defined gradient of band structures and interfacial built-in electric field at p-n heterojunctions direct photoelectrons migration, and facilitates the fast access to active Zr-oxo sites for efficient CO2 reduction. In-situ DRIFTS unravels that the superior catalytic activities can be attributed to the strong adsorption and activation capabilities for CO2 conversion to COOH* and CO* species. This work highlights an interfacial assembling strategy to design heterojunction photocatalysts for efficient solar fuel production.