Three luminescent metal–organic frameworks (MOFs) with 3-(4-carboxyphenyl)-1,3-benzoimidazole (HCPBm), named [Er(CPBm)3]n (1), [Zn(CPBm)2]n (2) and {Zn[Er(CPBm)(OH)(H2O)4]4·(ClO4)4·Cl2}n (3), have been synthesized using zinc(II) chloride, erbium(III) perchlorate and the ligand HCPBm under different pH conditions. Complex 1 obtained at pH = 5.5 exhibits a 1-D chain structure based on Er(III). At pH = 7.0, a 2-D Zn(II)-based layer 2 forms. The reaction at pH = 8.5 leads to a 2-D heteronuclear square grid layer 3 with a rare stacking fashion of ⋯ABCD⋯ in a 3-D supramolecular network. Compound 1 shows typical lanthanide Er(III) near-infrared emission, and compound 2 has strong fluorescent emission based on the ligand HCPBm. However, compound 3 presents sensitized near-infrared emission (λmax = 1500 nm) upon excitation of the Zn(II) unit in the visible region (400 nm) due to efficient energy transfer from the Zn(II) ion to the Er(III) units.