In the technology of microbial fuel cells (MFCs) for simultaneous electricity production and wastewater purification, the electricity production of MFCs decreases when the salt concentration in the wastewater is high. Increasing the electricity production of MFCs under high salt conditions is a great challenge. This paper studies the reasons for the decline of electricity production of MFCs under high salt conditions and develops ways to increase the electricity generation. The results show that high salt inhibits the growth of electrogenic microorganisms on the anode of MFCs, thereby reducing the electricity production. Addition of ectoine, an osmotic pressure compensated solute, can increase the salt tolerance of electrogenic microorganisms, thereby increasing the electricity generation of MFCs. With the addition of 1 mmol L−1 ectoine to the substrate, the average voltage output of the MFCs based on mixed microbial flora anode was increased by 60.4% (±3.9%). Under this condition, microbial diversity analysis showed that the dominant growth and electricity production genus Acinetobacter accounted for 38.9% in the microbial community of anode biofilm.