Improving the efficiency of anaerobic digestion (AD) of sewage sludge (SS) is a critical step toward the achievement of energy neutrality in wastewater treatment plants (WWTPs), as required by the European Green Deal. This study used a comparative techno-economic assessment (TEA) to evaluate the feasibility of producing biomethane, at a WWTP, through upgrading biogas with a double-stage permeation membrane plant. The biogas was originally generated from the AD of a mixture of primary sludge (PS) and either raw or pre-treated waste activated sludge (WAS), where biological or thermo-alkali pre-treatments were applied to increase the WAS intrinsic low degradability.The TEA was supported by the results of pilot-scale tests, carried out on WAS, which mimicked (i) a traditional mesophilic AD process; (ii) a two-stage AD process, where a temperature-phased anaerobic digestion (TPAD, 3 days, 55 °C + 20 days, 38 °C) was performed to biologically pre-treat WAS; (iii) a traditional mesophilic AD process preceded by a thermo-alkali (4 g NaOH/100 g TS, 90 °C, 90 min) pre-treatment.The TEA was carried out in two phases. In the first, the minimum size of the WWTP capable of making the costs necessary for the implementation of the biogas upgrading plant equal to the revenues coming from selling biomethane (at 62 €/MWh) in 10 years was calculated in the absence of pre-treatments. It resulted of 500,000 equivalent inhabitants (e.i.). In the second phase, for the WWTP size found previously, the effect of either biological or thermo-alkali pre-treatments on the economic balance was evaluated, that is the gain (or the loss) associated to the selling of biomethane, compared to the reference price of 62 €/MWh. It was found that the TPAD increased the biogas productivity by only 23.6%, too little to compensate the amount of heat necessary for the pre-treatment and the purchase cost of the additional reactor. Conversely, the thermo-alkali pre-treatment, which enhanced the WAS biogas productivity by 110%, increased the biomethane revenues by approx. 10 €/MWh, compared to the scenario without pre-treatments. This study offers useful data to WWTP managers who want to introduce WAS pre-treatments, combined with interventions for biogas upgrading, in a new or existing sludge line of a WWTP.