It is highly desirable to convert CO2 to valuable fuels or chemicals by means of solar energy, which requires CO2 enrichment around photocatalysts from the atmosphere. Here we demonstrate that a porphyrin-involved metal-organic framework (MOF), PCN-222, can selectively capture and further photoreduce CO2 with high efficiency under visible-light irradiation. Mechanistic information gleaned from ultrafast transient absorption spectroscopy (combined with time-resolved photoluminescence spectroscopy) has elucidated the relationship between the photocatalytic activity and the electron-hole separation efficiency. The presence of a deep electron trap state in PCN-222 effectively inhibits the detrimental, radiative electron-hole recombination. As a direct result, PCN-222 significantly enhances photocatalytic conversion of CO2 into formate anion compared to the corresponding porphyrin ligand itself. This work provides important insights into the design of MOF-based materials for CO2 capture and photoreduction.