Activated sludge is an alternative to pure cultures for polyhydroxyalkanoate (PHA) production due to the presence of many PHA-producing bacteria in activated sludge community. In this study, activated sludge was submitted to aerobic dynamic feeding in a sequencing batch reactor. During domestication, the changes of bacterial community structure were observed by terminal restriction fragment length polymorphism analysis. Furthermore, some potential PHA-producing bacteria, such as Thauera, Acinetobacter and Pseudomonas, were identified by denaturing gradient gel electrophoresis analysis. The constructed PHA synthase gene library was analyzed by DNA sequencing. Of the 80 phaC genes obtained, 76 belonged to the Class I PHA synthase, and four to the Class II PHA synthase. Gas chromatography–mass spectrometry analysis showed that PHA produced by activated sludge was composed of three types of monomers: 3-hydroxybutyrate, 3-hydroxyvalerate and 3-hydroxydodecanoate (3HDD). This is the first report of production of medium-chain-length PHAs (PHAMCL) containing 3HDD by activated sludge. Further studies suggested that a Pseudomonas strain may play an important role in the production of PHAMCL containing 3HDD. Moreover, a Class II PHA synthase was found to have a correlation with the production of 3HDD-containing PHAMCL.