A new method of preparing water-based sol–gel containing titania nanoparticles for the protection of aluminum alloy AA2024 against corrosion was presented and performance of the coating in Harrison's solution was studied. The coating was prepared using alkoxysilanes, tetraethylorthosilicate (TEOS) and 3-glycidoxypropyltrimethoxysilane (GPTMS), and in additional metal alkoxide, titanium(IV) tetrapropoxide (TPOT), as a source of titania particles. Poly(ethylene imine) (PEI) polymer was utilized to create cross-linking and also to improve the coating quality. In addition, the molar ratios and amount of components and factors affecting performance were assessed to improve coating properties and its performance. Potentiodynamic scan (PDS) and electrochemical impedance spectroscopy (EIS) measurements were performed to evaluate the corrosion protection performance of coatings. Also, scanning electron microscopy (SEM) was employed to investigate surface morphology. The stability of the best prepared coating and its corrosion protective effects on the alloy were evaluated in Harrison's solution up to 15 days. The results revealed that this new sol–gel coating provides significant protection against corrosion of the AA2024 alloy in Harrison's solution.