With constant population growth and the rise in technology use, the demand for electrical energy has increased significantly. Increasing fossil-fuel-based electricity generation has serious impacts on environment. As a result, interest in renewable resources has risen, as they are environmentally friendly and may prove to be economical in the long run. However, the intermittent character of renewable energy sources is a major disadvantage. It is important to integrate them with the rest of the grid so that their benefits can be reaped while their negative impacts can be mitigated. In this article, an energy management algorithm is recommended for a grid-connected microgrid consisting of loads, a photovoltaic (PV) system and a battery for efficient use of energy. A model predictive control-inspired approach for energy management is developed using the PV power and consumption estimation obtained from daylight solar irradiation and temperature estimation of the same area. An energy management algorithm, which is based on a neuro-fuzzy inference system, is designed by determining the possible operating states of the system. The proposed system is compared with a rule-based control strategy. Results show that the developed control algorithm ensures that microgrid is supplied with reliable energy while the renewable energy use is maximized.