While hypoxia promotes carcinogenesis, tumor aggressiveness, metastasis, and resistance to oncological treatments, the impacts of hyperoxia on tumors are rarely explored because in vivo long-lasting oxygen supply is a big challenge. Herein, we constructed a micro oxygen factory, namely photosynthesis microcapsules (PMCs) by encapsulation of acquired cyanobacteria and upconversion nanoparticles in alginate microcapsules. This system enabled long-lasting oxygen supply by converting external radiations into red emissions for photosynthesis in cyanobacteria. PMC treatment suppressed NF-kB pathway, HIF-1α production and cancer cell proliferation. Hyperoxia microenvironments created by in vivo PMC implants inhibited hepatocarcinoma growth and metastasis, synergized the effects of anti-PD-1 in breast cancer. The engineered oxygen factory offers potential for tumor biology study in hyperoxia microenvironments and will inspire the exploration of oncological treatments.