The advent of intelligent agents who produce and consume energy by themselves has led the smart grid into the era of prosumer, offering the energy system and customers a unique opportunity to revaluate/trade their spot energy via a sharing initiative. To this end, designing an appropriate sharing mechanism is an issue with crucial importance and has captured great attention. This paper addresses the prosumers demand response problem via energy sharing. Under a general supply-demand function bidding scheme, a sharing market clearing procedure considering network constraints is proposed, which gives rise to a generalized Nash game. The existence and uniqueness of market equilibrium are proved in non-congested cases. When congestion occurs, infinitely much equilibrium may exist because the strategy spaces of prosumers are correlated. A price-regulation procedure is introduced in the sharing mechanism, which outcomes a unique equilibrium that is fair to all participants. Properties of the improved sharing mechanism, including the individual rational behaviors of prosumers and the components of sharing price, are revealed. When the number of prosumers increases, the proposed sharing mechanism approaches social optimum. Even with fixed number of resources, introducing competition can result in a decreasing social cost. Illustrative examples validate the theoretical results and provide more insights for the energy sharing research.