The world needs new energy sources that give adequate yields at low economic and environmental costs. Biofuels such as biodiesel and biogas are viable options to offset usage of traditional fossil fuels and reduce environmental damage. In this context, microalgae are promising organisms for biodiesel production due to their capacity to accumulate significant amounts of lipids. Additionally, anaerobic digestion is becoming an efficient and widely utilized system for the generation of renewable biogas; and microalgae are a suitable substrate for such purpose. To date, research on microalgal biofuels has been performed mainly at a pilot-scale due to economic considerations and, in some cases, negative energy balances of the processes or potentially unsustainable practices. For example, a large amount of mineral fertilizer is often used to mass-produce microalgae. More research is required to make biofuel production more sustainable and suitable at large scale. An attractive way to overcome these issues is to develop an integrated production system with minimal inputs to reduce the environmental cost of production by recycling nutrients. This can be achieved through the anaerobic digestion of algal biomass. The anaerobic digestion process not only produces biogas but also allows nutrient recycling for repeat algae cultivation. On the other hand, lipid extraction for biodiesel production leaves a residue that is a potential substrate for anaerobic digestion. Lipid-extracted biomass may have an advantage over pure algal cultures of a higher native digestibility due to cell disruption during the lipid extraction process. Hence, an integrated system of biodiesel and biogas production using anaerobic digestion effluent as a nutrient source for algae growth and lipid-extracted biomass as substrate for digestion may present a good option. This thesis focused on the optimization of a closed nutrient loop for oil and biogas production through anaerobic digestion of microalgae. The study was oriented towards the scalability of the system aiming to optimize the main aspects that currently jeopardize the application of the proposed biorefinery at large scale. To address these issues three main aspects were investigated: (1) Wet and solvent-free lipid extraction, (2) Osmotic shock as pre-treatment for lipid extraction and biogas production and (3) Nutrient recycling for algae growth. This dissertation has been structured as follows: Chapter 1 is a literature review of the system proposed. Chapter 2 evaluates the anaerobic digestion of the microalga Scenedesmus dimorphus under continuous conditions as well as the potential of the anaerobic digestate as culture medium for the same species. In chapter 3 the feasibility of a wet solvent-free lipid extraction procedure by using osmotic shock is evaluated as pre-treatment. The species Dunaliella salina and Chaetoceros muelleri were chosen for this purpose as they have very fragile cell wall. Besides, the methane Publications included in this thesis GONZÁLEZ-GONZÁLEZ, L. M., ELTANAHY, E...