NOVELTY - The method comprises fermenting biomass in a hydrolysis- and a methanation step, converting a part of the produced biogas into thermal energy, and reducing the carbon dioxide content of the biogas by a cleaning step. The thermal energy is used for covering a part of the energy requirements of a biogas plant. The part of the biomass converted into thermal energy is a part of the hydrolysis gas produced in the hydrolysis step, and has a methane content of maximum 30 vol.%. The hydrolysis gas is enriched with a part of the methanation gases produced in the methanation step.    USE - Method for generating biogas by fermenting biomass in a biogas plant.    ADVANTAGE - The method ensures energy-efficient, simple and economical generation of the biogas with high natural gas quality and high performance.    DETAILED DESCRIPTION - The method comprises fermenting biomass in a hydrolysis- and a methanation step, converting a part of the produced biogas into thermal energy, and reducing the carbon dioxide content of the biogas by a cleaning step. The thermal energy is used for covering a part of the energy requirements of a biogas plant. The part of the biomass converted into thermal energy is a part of the hydrolysis gas produced in the hydrolysis step, and has a methane content of maximum 30 vol.%. The hydrolysis gas is enriched with a part of the methanation gases produced in the methanation step. The biogas is obtained in natural gas quality by the cleaning step. The reduction step is carried out by chemical-, water wash, wash with sodium hydroxide solution, Selexol (RTM: Physical solvent) wash, or ethanolamine wash. The thermal energy is used for covering the energy requirements of the hydrolysis and methanation steps, cleaning step and reduction step, and for covering the regeneration of the chemicals used during the reduction of the carbon dioxide content by the ethanolamine wash. The part of the biogas provided for converting into thermal energy is displaced with 1-5 vol.% of air before converting into thermal energy. The remaining biomass substrate is removed from the methanation step after fermenting and is injected into the hydrolysis step. A part of the solids is removed from the remaining biomass substrate before injecting. The pH of the biomass substrate in the hydrolysis step is 5.5-7.0. An INDEPENDENT CLAIM is included for a biogas plant for generating biogas by fermenting biomass.