The increasing energy prices and the need to provide energy security during emergencies have pushed researchers and companies to find smarter and more sustainable solutions. In this context, microgrids appear to be increasingly popular. In this paper we present an energy sharing framework for microgrids in which houses share their renewable energy, harvested from some kind of on-site renewables, by transmitting it to an Energy Management Center (EMC). In each time period, the EMC collects the renewable energy and stores it in a central storage unit. It also receives power requests from demanding houses and manages distribution. How to achieve a fair and efficient energy allocation is a challenging problem. For this purpose, we propose a reputation-based energy distribution mechanism that allows the EMC to allocate energy to houses when they request it according to their reputation. We apply our mechanism over three different classes of households. Simulation results show that our energy sharing framework improves the utilization of renewable energy and that the proposed energy allocation mechanism achieves fairness. It is also expected to promote energy conscious behavior as houses will receive energy in proportion to their contribution and energy consumption behavior.