This study constructed a cyanobacteria-bacteria consortium using a mixture of non-toxic cyanobacteria (Synechococcus sp. and Chroococcus sp.) immobilized in calcium alginate and native bacteria in wastewater. The consortium was used for the advanced treatment of sulfamethoxazole-polluted wastewater and the production of cyanobacterial lipid. Mixed cyanobacteria increased the abundances of denitrifying bacteria and phosphorus-accumulating bacteria as well as stimulated various functional enzymes in the wastewater bacterial community, which efficiently removed 70.01–71.86% of TN, 91.45–97.04% of TP and 70.72–76.85% of COD from the wastewater. The removal efficiency of 55.29–69.90% for sulfamethoxazole was mainly attributed to the upregulation of genes encoding oxidases, reductases, oxidoreductases and transferases in two cyanobacterial species as well as the increased abundances of Stenotrophomonas, Sediminibacterium, Arenimonas, Novosphingobium, Flavobacterium and Hydrogenophaga in wastewater bacterial community. Transcriptomic responses proved that mixed cyanobacteria presented an elevated lipid productivity of 33.90 mg/L/day as an adaptive stress response to sulfamethoxazole. Sediminibacterium, Flavobacterium and Exiguobacterium in the wastewater bacterial community may also promote cyanobacterial lipid synthesis through symbiosis. Results of this study proved that the mixed cyanobacteria-bacteria consortium was a promising approach for advanced wastewater treatment coupled to cyanobacterial lipid production.