In order to remove high concentrations of ammonia nitrogen (NH4+-N) and refractory sulfamethazine (SM2) from swine digestion effluent, different carbon/nitrogen (C/N) ratios and salinity were used to determine the effects of pollutants removal in the microalgae biofilm system. Microalgae biofilm treatment under optimal environmental conditions in synthetic swine digestion effluent were C/N ratio of 20 and salinity of 140 mM. In order to make the actual swine digestion effluent discharge up to the standard, three different two-cycle treatments (suspended microalgae, microalgae biofilm, microalgae biofilm under the optimal conditions) were studied. The results showed that after two-cycle treatment with microalgae biofilm under the optimal conditions, the actual swine digestion effluent levels of total nitrogen (TN), NH4+-N, total phosphorus (TP), chemical oxygen demand (COD), SM2 were 22.65, 9.32, 4.11, 367.28, and 0.99 mg L−1, respectively, which could satisfy the discharge standards for livestock and poultry wastewater in China. At the same time, first-order kinetic simulation equations suggested a degradation half-life of 4.85 d for SM2 under optimal conditions in microalgae biofilm, and microbial community analysis indicated that the dominant genus was Halomonas. Furthermore, 35.66% of lipid, 32.56% of protein and 18.44% of polysaccharides were harvested after two-cycle in microalgae biofilm treatment under optimal environmental conditions. These results indicated that the regulation of C/N and salinity in microalgae biofilm for the treatment of swine digestion effluent was a high-efficiency strategy to simultaneously achieve wastewater treatment and bioenergy production.