A simple method for the fabrication of highly photoactive nanocrystalline two-layer TiO2 electrodes for solar cell applications is presented. Diluted titanium acetylacetonate has been used as a precursor for covering SnO2:F (FTO) films with dense packed TiO2 nanocrystallites. The nanoporous thick TiO2 film follows the dense packed thin TiO2 film as a second layer. For the latter, amorphous TiO2 nanoparticles have been successfully synthesized by a sol-gel technique in an acidic environment with pH<1 and hydrothermal growth at a temperature of 200°C. The acidic nanoparticle gel was neutralized by basic ammonia and a TiO2 gel of pH 5 was obtained; this pH value is higher than the recently reported value of 3.1 (Park et al 2005 Adv. Mater. 17 2349-53). Highly interconnected, nanoporous, transparent and active TiO 2 films have been fabricated from the pH 5 gel. SEM, AFM and XRD analyses have been carried out for investigation of the crystal structure and the size of nanoparticles as well as the surface morphology of the films. Investigation of the photocurrent-voltage characteristics has shown improvement in cell performance along with the modification of the surface morphology, depending on pH of the TiO2 gel. Increasing the pH of the gel from 2.1 to 5 enhanced the overall conversion efficiency of the dye-sensitized solar cells by approximately 30%. An energy conversion efficiency of 8.83% has been achieved for the cell (AM1.5, 100 mWcm-2 simulated sunlight) compared to 6.61% efficiency in the absence of ammonia in the TiO2 gel.