In this study, the relationship between morphology, porosity, and the photocatalytic activityof the anatase phase of TiO2 was investigated. The synthesis of anatase samples was carriedout by a modified sol–gel method, using two ionic surfactants (sodium dodecyl sulfate (SDS)and cetyltrimethylammonium bromide (CTAB)), and polyethylene glycol (PEG) as a nonionicsurfactant, or no surfactant (NS). In addition, the photocatalytic activities of the anatasesamples were investigated through adsorption experiments and photodegradation usingmethylene blue. The experimental results showed that the specific surface area of anatasesamples increased as the pore size increased, following the order SDS > NS > CTAB > PEG, andthe adsorption and photodegradation of methylene blue by the anatase samples increasesin the same order. The spherical morphology and porosity of the mesoporous nanoparticlesof the SDS sample improved the absorption of light in the visible region. The anatase sampleSDS had a low band gap value (2.97 eV), the highest specific surface area (138.72 m2/g), andshowed the highest photocatalytic activity.