Shale gas production is associated with significant usage of fresh water and discharge of wastewater. Consequently, there is a necessity to create proper management strategies for water resources in shale gas production and to integrate conventional energy sources (e.g., shale gas) with renewables (e.g., solar energy). The objective of this study is to develop a design framework for integrating water and energy systems including multiple energy sources, the cogeneration process and desalination technologies in treating wastewater and providing fresh water for shale gas production. Solar energy is included to provide thermal power directly to a multi-effect distillation plant (MED) exclusively (to be more feasible economically) or indirect supply through a thermal energy storage system. Thus, MED is driven by direct or indirect solar energy and excess or direct cogeneration process heat. The proposed thermal energy storage along with the fossil fuel boiler will allow for the dual-purpose system to operate at steady-state by managing the dynamic variability of solar energy. Additionally, electric production is considered to supply a reverse osmosis plant (RO) without connecting to the local electric grid. A multi-period mixed integer nonlinear program (MINLP) is developed and applied to discretize the operation period to track the diurnal fluctuations of solar energy. The solution of the optimization program determines the optimal mix of solar energy, thermal storage and fossil fuel to attain the maximum annual profit of the entire system. A case study is solved for water treatment and energy management for Eagle Ford Basin in Texas.