This paper presents a novel control strategy for the optimal management of microgrids with high penetration of renewable energy sources and different energy storage systems. The control strategy is based on the integration of optimal generation scheduling with a model predictive control in order to achieve both long and short-term optimal planning. In particular, long-term optimization of the various microgrid components is obtained by the adoption of an optimal generation scheduling, in which a statistical approach is used to take into account weather and load forecasting uncertainties. The real-time management of the microgrid is instead entrusted to a model predictive controller, which has the important feature of using the results obtained by the optimal generation scheduling. The proposed control strategy was tested in a laboratory-scale microgrid present at the University of Seville, which is composed of an electronic power source that emulates a photovoltaic system, a battery bank and a hydrogen production and storage system. Two different experimental tests that simulate a summer and a winter day were carried out over a 24-h period to verify the reliability and performance enhancement of the control system. Results show an effective improvement in performance in terms of reduction of the microgrid operating cost and greater involvement of the hydrogen storage system for the maintenance of a spinning reserve in batteries.