Despite the significant breakthroughs in research on microalgae as a feedstock for biodiesel, its production cost is still much higher than that of fossil diesel. One possible solution to overcome this problem is to optimize algal growth and lipid production in wastewater. The present study examines the optimization of pretreatment of municipal wastewater and aeration conditions in order to enhance the lipid productivity of Scenedesmus obliquus. Results showed that no significant differences were recorded in lipid productivity of S. obliquus grown in primary settled or sterilized municipal wastewater; however, ultrasound pretreatment of wastewater significantly decreased the lipid production. Whereas, aeration rates of 0.2 vvm significantly increased lipid content by 51 %, with respect to the non-aerated culture, which resulted in maximum lipid productivity (32.5 mg L(-1) day(-1)). Furthermore, aeration enrichment by 2 % CO2 resulted in increase of lipid productivity by 46 % over the CO2 non-enriched aerated culture. Fatty acid profile showed that optimized aeration significantly enhanced monounsaturated fatty acid production, composed mainly of C18:1, by 1.8 times over the non-aerated S. obliquus culture with insignificant changes in polyunsaturated fatty acid proportion; suggesting better biodiesel characteristics for the optimized culture.