In this study, we develop a facile and feasible synthetic technique for producing denser porous titanium dioxide (TiO2) films. The porous TiO2 films are effectively prepared using a sol–gel process with dimethylformamide (DMF). The TiO2 solution is synthesized by adjusting DMF doses ranging from 0 to 10 wt%, and the as-grown TiO2 films are further annealed at different temperatures from 300 to 500 °C. The TiO2 films exhibit an asymmetry anatase TiO2 phase as annealing temperatures increase, and a denser structure as DMF doses increase. The optical properties of all samples are studied, and the porous TiO2 obtained by 7.5 wt% DMF dose demonstrates a remarkable transmittance and reflectance of 51.87% and 27.55%, respectively, in the visible region from 350 to 850 nm when compared to the pure TiO2 films. The calculated band gap values range from 3.15 to 3.25 eV. Furthermore, the resistivity of 350 °C-annealed porous TiO2 thin film is determined by the Hall effect, revealing an increase from 4.46 to an of average 4.79 ohm · cm after injecting DMF solvent. These findings have the potential to assist a growing number of optoelectronic applications.