Porous silicon-based nanocomposite hydrogels were readily constructed with the gelation of poly(ethylene glycol) double acrylates (PEGDA) macromers, due to the initiation of singlet oxygen photosensitized with porous silicon nanoparticles (PSiNPs) under near-infrared (NIR) light irradiation. Multifunctional PSiNPs/PEGDA nanocomposite hydrogels showed strong fluorescence, excellent biodegradability, significant photothermal effect, and sustained drug release with high efficiency (>80%). Finally, in situ growth of PSiNPs/PEGDA hybrid hydrogels on cancer cells was also achieved by NIR light, and then their biodegradation, drug release and synergistic chemo-phototherapeutic efficacy were further demonstrated, which could provide a significant localized inhibition for the viability, adherence, and migration of cancer cells in vitro. Thus, we suggested that these resultant hybrid hydrogels would have important potential on local cancer therapy in future clinical practice.