Method for producing biogas comprising the following steps: a) providing a lignocellulosic biomass b) pretreating the lignocellulosic biomass at a temperature of 120-250 °C, preferably 140-230 °C, such as 170-220 °C and at a pH of 0.5 to 3.0, preferably at a pH of 1.0 to 2.5, such that a slurry of pretreated lignocellulosic biomass is obtained c) providing a waste activated sludge (W.A.S.) having a pH between 5.0 and 8.0, such as between 6.0 and 7.5 d) mixing the slurry of pretreated lignocellulosic biomass obtained in step b) with the W.A.S. provided in step c) such that a mixture comprising W.A.S. and pretreated lignocellulosic biomass is obtained e) incubating the mixture obtained in step d) for at least 20 minutes such that a mixture of pretreated W.A.S. and pretreated lignocellulosic biomass is obtained f) anaerobic digestion of the mixture of pretreated W.A.S. and pretreated lignocellulosic biomass obtained in e) by incubation of the mixture for a second incubation time at a temperature of 30-60 °C, preferably 35-55 °C preferably 35-40 °C in a digester comprising anaerobic microorganisms such that biogas and a digestate is produced, wherein the pH of the mixture obtained in step d) is 0.5-3.0 and wherein the temperature of the mixture obtained in step d) is 75-99 °C and wherein the method further comprises the steps of - adjusting the pH of the mixture of pretreated W.A.S. and pretreated lignocellulosic biomass obtained in e), prior to step f), such that the pH of the mixture of pretreated W.A.S. and pretreated lignocellulosic biomass is 6.0-8.0, preferably 6.5-7.5, such as 6.8-7.2 and - adjusting the temperature of the mixture of pretreated W.A.S. and pretreated lignocellulosic biomass obtained in step e) to a temperature of 30-60 °C, preferably 35-55 °C preferably 35-40 °C, prior to step f). a) providing a lignocellulosic biomass b) pretreating the lignocellulosic biomass at a temperature of 120-250 °C, preferably 140-230 °C, such as 170-220 °C and at a pH of 0.5 to 3.0, preferably at a pH of 1.0 to 2.5, such that a slurry of pretreated lignocellulosic biomass is obtained c) providing a waste activated sludge (W.A.S.) having a pH between 5.0 and 8.0, such as between 6.0 and 7.5 d) mixing the slurry of pretreated lignocellulosic biomass obtained in step b) with the W.A.S. provided in step c) such that a mixture comprising W.A.S. and pretreated lignocellulosic biomass is obtained e) incubating the mixture obtained in step d) for at least 20 minutes such that a mixture of pretreated W.A.S. and pretreated lignocellulosic biomass is obtained f) anaerobic digestion of the mixture of pretreated W.A.S. and pretreated lignocellulosic biomass obtained in e) by incubation of the mixture for a second incubation time at a temperature of 30-60 °C, preferably 35-55 °C preferably 35-40 °C in a digester comprising anaerobic microorganisms such that biogas and a digestate is produced, wherein the pH of the mixture obtained in step d) is 0.5-3.0 and wherein the temperature of the mixture obtained in step d) is 75-99 °C and wherein the method further comprises the steps of - adjusting the pH of the mixture of pretreated W.A.S. and pretreated lignocellulosic biomass obtained in e), prior to step f), such that the pH of the mixture of pretreated W.A.S. and pretreated lignocellulosic biomass is 6.0-8.0, preferably 6.5-7.5, such as 6.8-7.2 and - adjusting the temperature of the mixture of pretreated W.A.S. and pretreated lignocellulosic biomass obtained in step e) to a temperature of 30-60 °C, preferably 35-55 °C preferably 35-40 °C, prior to step f). - adjusting the pH of the mixture of pretreated W.A.S. and pretreated lignocellulosic biomass obtained in e), prior to step f), such that the pH of the mixture of pretreated W.A.S. and pretreated lignocellulosic biomass is 6.0-8.0, preferably 6.5-7.5, such as 6.8-7.2 and - adjusting the temperature of the mixture of pretreated W.A.S. and pretreated lignocellulosic biomass obtained in step e) to a temperature of 30-60 °C, preferably 35-55 °C preferably 35-40 °C, prior to step f).