A combination of organic and inorganic components was used to synthesize the nanocomposites TCPP-SSA-P25-PMMA, which involved connecting porphyrin and TiO2. These nanocomposites were then used to create optical devices with practical uses. The Z-scan technique was employed to investigate the nonlinear optical properties of the material. The results demonstrated that TCPP-SSA-P25-PMMA possesses outstanding nonlinear optical properties, with a value of 2.5 × 10-9 m/W and an Im[χ(3)] of 15.8 × 10-11 esu. TCPP-SSA-P25-PMMA was incorporated into a poly (methyl methacrylate) (PMMA) matrix to produce TCPP-SSA-P25-PMMA/PMMA optical plastic, which exhibited improved third-order optical nonlinearity, with a value of 5.1 × 10-9 m/W and an Im[χ(3)] of 1.68 × 10-10 esu. Furthermore, it displayed a dynamic range of 0.4 and a minimum transmittance of 0.4. These enhancements were attributed to the suppression of the porphyrin group's aggregation effect on TCPP-SSA-P25-PMMA in the solid matrix. As a result, the nanocomposite has substantial potential for practical applications.