In this study the wastewater treatment of a gas refinery was investigated by using an aerobic trickle bed filter bioreactor. Using a methanothrophic bacterium was the only difference of this experiment from the common aerobic wastewater treatment processes. In addition to reach the standards of wastewater treatments the other goal of using this special bacterium was the production of a bacterial biomass which can be used as a biofertilizer. The optimization of major effective parameters such as inoculum size, ammonium sulfate, sodium hydrogen phosphate and methanol concentration and hydraulic and retention time was carried out by using the simple experiment design method of one variable at the time in a trickle bed bioreactor. The results of this study showed that the maximum biofertilizer production of 0.45 g/lit was obtainable in the optimum conditions including inoculum size of 0.27g/lit, ammonium sulfate concentrations of 0.25g/lit, sodium hydrogen phosphate concentration of 0.1g/lit, methanol concentration of 0.1g/lit, hydraulic time of 1.6 minutes and retention time of 24 hours.