In this study, co-culture of microalgae and activated sludge in photobioreactors (PBRs) was investigated at different inoculation ratios (0:1, 0.3:1, 0.7:1, and 1.3:1 sludge wt./algae wt.) for rural domestic wastewater treatment under direct solar radiation. Effluent qualities (such as pH, NO2 - , PO4 3- , and NH4 + -N concentrations) were assessed; bacterial and microalgal communities in co-culture system were compared. The microalgal and bacterial biomass fraction played a significant role in the performance and microbial community structure of the treatment system. In reactors with inoculation ratio of 0.3:1 and 0.7:1, the pH exceeded 9 or 10 under solar radiation, which led to some functional bacteria being missing. In the reactor with inoculation ratio of 1.3:1, activated sludge effectively prevented excessive increase in pH in the reactor. Similar observations were made for reactors with inoculation ratios below 1.3:1 by adding sludge halfway through the process. The results show that activated sludge can inhibit excessive increase in pH caused by algal photosynthesis, maintain the activity of nitrite-oxidizing bacteria in PBR, and reduce algae loss with the effluent. PRACTITIONER POINTS: Appropriate fraction of activated sludge can effectively inhibit the excessive increase in pH caused by algal photosynthesis in PBR. Adding activated sludge could maintain the activity of nitrite-oxidizingbacteria in PBR, and reduce microalgae loss with the effluent. Considering the stability of operation and biodiversity in PBR, a 1.3:1 inoculation ratio of activated sludge and microalgae is preferred.