An Observer-based Perturbation Extremum Seeking Control (PESC) is proposed for a Direct-Contact Membrane Distillation (DCMD) process. The process is described with a dynamic model that is based on a 2D Advection-Diffusion Equation (ADE) model which has pump flow rates as process inputs. The objective of the controller is to optimize the trade-off between the permeate mass flux and the energy consumption by the pumps inside the process. Cases of single and multiple control inputs are considered through the use of only the feed pump flow rate or both the feed and the permeate pump flow rates. A nonlinear Lyapunov-based observer is designed to provide an estimation for the temperature distribution all over the designated domain of the DCMD process. Moreover, control inputs are constrained with an anti-windup technique to be within feasible and physical ranges. Performance of the proposed structure is analyzed, and simulations based on real DCMD process parameters for each control input are provided.