The PSA unit 18 produces a high-quality methane stream, i.e. at least about 70% methane, for pipeline quality, at least about 90% methane, by selectively adsorbing much of the carbon dioxide, hydrogen sulfide, and other contaminants over the less readily adsorbable methane in the biogas stream.