NOVELTY - Producing (M1) ethanol and biogas involves: directing an incoming feedstock to pretreatment area and pretreating feedstock to free sugar from feedstock; fermenting sugar produced from feedstock in fermenter to produce beer including feedstock and ethanol; distilling beer to produce ethanol and whole stillage which includes liquid, dissolved solids and suspended solids; directing the whole/thin stillage to anaerobic membrane bioreactor having an anaerobic digester and membrane separation unit; recycling backset permeate and mixing the backset permeate with incoming feedstock.    USE - For producing ethanol and biogas (claimed).    ADVANTAGE - The method totally remove total suspended solids from whole or thin stillage which will in turn increase the effective capacity of each fermentation batch; reduce energy cost to produce the by-products such as dry distillers grain (DDG) and dry distillers grain syrup (DDGS); generate a surplus of energy and potentially increase the overall production efficiency of an ethanol plant. The anaerobic digester produces biogas that can be utilized to power evaporators, dryers and other equipment that might be used in an ethanol process to produce by-products. The substrate preparation unit produces feedstock in the form of a mash where the starch associated with the feedstock has been converted to sugar.    DETAILED DESCRIPTION - Producing (M1) ethanol and biogas involves: directing an incoming feedstock to a pretreatment area and pretreating the feedstock to free sugar from the feedstock; fermenting the sugar produced from the feedstock in a fermenter to produce beer which includes the feedstock and ethanol; distilling the beer to produce ethanol and whole stillage which includes liquid, dissolved solids and suspended solids; directing at least a portion of the whole stillage or a portion of thin stillage produced from the whole stillage to an anaerobic membrane bioreactor having an anaerobic digester and a membrane separation unit and: (1) in the anaerobic digester anaerobically digesting solids in the stillage and producing biogas and a mixed liquor; and (2) directing the mixed liquor from the anaerobic digester to the membrane separation unit and removing suspended solids from the mixed liquor and in the process producing a concentrated reject stream and a backset permeate that is substantially free of suspended solids; recycling at least a portion of the backset permeate and mixing the backset permeate with the incoming feedstock and where the mixture of the backset permeate and the incoming feedstock is fermented in the fermenter; optionally stratifying the mixed liquor in the anaerobic digester by forming a first lower mixed liquor zone where the mixed liquor in the first lower mixed liquor zone includes a relatively high concentration of solids, and forming a second mixed liquor zone above the first lower mixed liquor zone where the mixed liquor in the second zone includes a solids concentration substantially less than the concentration of solids in the first lower mixed liquor zone; and optionally directing mixed liquor from the second mixed liquor zone in the anaerobic digester to the membrane separation unit where the mixed liquor is separated into the concentrated reject stream and the backset permeate that is relatively free of suspended solids.