TECHNOLOGY FOCUS - ORGANIC CHEMISTRY - Preferred Method: The separation unit is a pressure swing adsorption system capable of discharging a purified, methane-containing product gas from it as a less readily adsorbable component of the biogas feed stream and discharging a low-quality gas stream as a tail gas containing more readily adsorbable components comprising a minor amount of methane, carbon dioxide and other impurities present in the biogas feed stream. The combining of the portion of biogas feed stream with the tail gas is controlled by analyzing the composition of the combined stream and controlling the portion size of the biogas feed stream mixed with the tail gas stream to meet a target heating value. The low-quality gas stream is combined with a portion of the biogas feed stream or purified, methane-containing product gas, which meets a target heating value, prior to utilizing the low-quality gas as a fuel. The ratio of the portion of biogas removed from the biogas feed stream to the total biogas feed stream is 10-60%, preferably 20-35%. The combined gas stream: is utilized as a fuel for a boiler that provides heat for the anaerobic digestion system; and contains methane (30-55%, preferably 40-50%). The composition of the combined gas stream is controlled by measuring the methane and/or carbon dioxide and/or the heating value of the tail gas stream and controlling the amount of the biogas feed stream or product gas stream mixed with the tail gas stream to ensure complete combustion of the mixed gas stream. The ratio of the portion of product gas removed from the product gas stream to the total product gas stream is 10-60%, preferably 20-30%. The separation unit is: adjusted to reduce the methane recovered in the purified, methane-containing product gas to increase the methane in the low-quality gas stream and the low-quality gas stream meets a target heating value, where the adjusting of the pressure swing adsorption system is accomplished by operating the pressure swing adsorption system at shorter cycle times so that the pressure swing adsorption system achieves the targeted heating value in the low-quality gas stream; and a membrane system (204) capable of discharging a non-permeate purified, methane-containing product gas stream from it and permeating a stream (206) containing more permeable (208) components comprising methane, carbon dioxide and other impurities present in the biogas feed stream, where the adjusting of the separation unit is achieved by adjusting the amount of methane permeated in the biogas feed stream to deliver the permeate gas stream with a targeted heating value for use as a fuel. EXAMPLE - No suitable example given.