A two-stage ultrafiltration and nanofiltration (UF/NF) process for the treatment of model dairy wastewater was investigated to recycle nutrients and water from the wastewater. Ultracel PLGC and NF270 membranes were found to be the most suitable for this purpose. In the first stage, protein and lipid were concentrated by the Ultracel PLGC UF membrane and could be used for algae cultivation to produce biodiesel and biofuel, and the permeate from UF was concentrated by the NF270 membrane in the second stage to obtain lactose in retentate and reusable water in permeate, while the NF retentate could be recycled for anaerobic digestion to produce biogas. With this approach, most of dairy wastewater could be recycled to produce reusable water and substrates for bioenergy production. Compared with the single NF process, this two-stage UF/NF process had a higher efficiency and less membrane fouling.