The invention belongs to the field of microbial electrochemistry, and discloses a method for in-situ recovery of high-purity struvite through a microbial electrolytic cell. The method comprises the steps that at least one of phosphorus-containing wastewater and phosphorus-containing sludge is added into the microbial electrolytic cell after microbial acclimation, an external voltage is applied tocarry out a microbial electrolysis reaction for a period of time, and then struvite sediment can be separated out, wherein the external voltage is smaller than the electrolytic voltage of water. According to the method, a microbial electrolytic cell (MEC) technology is utilized, and micro-voltage less than that of electrolytic water is adopted so that the problems that the time for obtaining the struvite through ectopic crystallization is long, the purity is low, particles are small and the sedimentation and separation performance is poor can be effectively solved, and the electric energy consumption is greatly reduced. Moreover, the method is based on an in-situ reaction, on the premise that stirring is not needed, the nucleation rate of struvite crystals is increased, the growth rate ofthe struvite crystals is increased, the limit of the growth of the struvite crystals is broken through, the particle size of the struvite is increased, the purity of the struvite is improved, and in-situ crystallization recovery of the high-purity struvite is achieved.