This paper proposes a real-time neighborhood energy management (NEM) approach that aims to manage real-time residential energy. The introduced approach considers the neighborhood energy surpluses in order to reduce peak load demand and gas emissions. First, NEM allows decreases in energy cost by optimally choosing between locally generated energy, neighborhood energy surplus, or grid supplied. Second, NEM maximizes the producer’s gains by selling the excess energy not only to the utility companies but also to neighbors at a more profitable price. Our proposed energy selling price is flexible and adequately adapted to the user’s excess energy. Simulation results proved the effectiveness of our proposed approach. The results show that our energy sharing pricing model satisfies the requirements of each user (minimizing energy cost and maximizing gain). NEM can effectively motivate and encourage users to share energy.