Polyhydroxyalkanoates are known to be temporarily stored by microorganisms in activated sludge, especially in anaerobic-aerobic processes. Due to the problems resulted from the disposals of plastic wastes and excess sludge of wastewater treatment plants, the production of polyhydroxyalkanoates by treating activated sludge and determining the effect of process variables were the main issues of this paper. In this research, an anaerobic-aerobic sequencing batch reactor was used to make microorganism adapted and a batch aerobic reactor was used for enriching them. The variables affecting polyhydroxyalkanoates production including aeration time, sludge retention time, and volatile fatty acids concentration of the influent in sequencing batch reactor, and also carbon to nitrogen ratio and cultivation time in polymer production reactor, were investigated using Taguchi statistical approach to determine optimum conditions. The maximum polymer production of 29% was achieved at sludge retention time of 5–10 days, aeration time of 2 hours, supplementation of 40% of volatile fatty acids in the influent and increasing of carbon to nitrogen ratio of polymer production reactor to above 25 g/g. Based on the results, in optimum conditions, the volatile fatty acids concentration which increased the production of polyhydroxyalkanoates up to 49% was the most effective variable. Carbon to nitrogen ratio, sludge retention time and aeration time were ranked as the next affecting parameters. Although the polyhydroxyalkanoates content achieved in present study is much lower than that by pure culture, but the proposed method may still serve well as an environmental friendly means to convert waste into valuable product.