In this paper, the nonlinear economic model predictive control based energy management of a multi-energy microgrid is presented. The microgrid is composed of the district heating system with a cogeneration power plant supplying both the heat and the electricity demand of residential buildings with photovoltaic sources. Furthermore, access to liberalized heat and electricity market is assumed. This kind of environment requires consideration of the economical aspects, the technical aspects, the safety/quality of supply, and consumer preferences. The major contributions introduced in the presented approach are the following. A nonlinear formulation is adopted to capture the nonlinear thermal models and the nonlinear algebraic model of the heat supply network. The second major contribution is the economic character of the objective following the assumption of a liberalized market environment. Such formulation accounts for the specifics of the energy market organization. Finally, the stochastic nature of the planning problem is introduced through a practical robust formulation. The results obtained on a representative case study clearly show the benefits of the proposed approach compared to the traditional energy management approach.