Despite numerous inherent merits of metal-organic frameworks (MOFs), structural fragility has imposed great restrictions on their wider involvement in many applications, such as in catalysis. Herein, a strategy for enhancing stability and enabling functionality in a labile Zr(IV)-MOF has been proposed by in situ porphyrin substitution. A size-and geometry-matched robust linear porphyrin ligand 4,4′-(porphyrin-5,15-diyl)dibenzolate (DCPP 2− ) is selected to replace the 4,4′-(1,3,6,8-tetraoxobenzo[lmn][3,8]phenanthroline-2,7(1H,3H,6H,8H)-diyl)dibenzoate (NDIDB 2− ) ligand in the synthesis of BUT-109(Zr), affording BUT-110 with varied porphyrin contents. Compared to BUT-109(Zr), the chemical stability of BUT-110 series is greatly improved. Metalloporphyrin incorporation endows BUT-110 MOFs with high catalytic activity in the photoreduction of CO 2 , in the absence of photosensitizers. By tuning the metal species and porphyrin contents in BUT-110, the resulting BUT-110-50%-Co is demonstrated to be a good photocatalyst for selective CO 2 -to-CO reduction, via balancing the chemical stability, photocatalytic efficiency, and synthetic cost. This work highlights the advantages of in situ ligand substitution for MOF modification, by which uniform distribution and high content of the incoming ligand are accessible in the resulting MOFs.More importantly, it provides a promising approach to convert unstable MOFs, which mainly constitute the vast MOF database but have always been neglected, into robust functional materials.