In aerobic granular sludge (AGS) systems, different-sized microbial aggregates having different solids retention time (SRT) coexist in the same reactor compartment and are subjected to the same influent wastewater. Thus, the AGS system provides a unique ecosystem to study the importance of local (species sorting) and regional (immigration) processes in bacterial community assembly. The microbial communities of different-sized aggregates (flocs <0.2 mm, small granules (0.2-1.0 mm) and large granules >1.0 mm), influent wastewater, excess sludge and effluent of a full-scale AGS plant were characterized over a steady-state operation period of 6 months. Amplicon sequencing was integrated with mass balance to determine the SRT and net growth rate of operational taxonomic units (OTUs). We found strong evidence of species sorting as opposed to immigration, which was significantly higher at short SRT (i.e., flocs and small granules) than that at long SRT (large granules). Rare OTUs in wastewater belonging to putative functional groups responsible for nitrogen and phosphorus removal were progressively enriched with an increase in microbial aggregates size. In contrast, fecal- and sewage infrastructure-derived microbes progressively decreased in relative abundance with increase in microbial aggregate size. These findings highlight the importance of AGS as a unique model ecosystem to study fundamental microbial ecology concepts.