With the development of smart grids, a renewable energy generation system has been introduced into a smart house. The generation system usually supplies a storage system with the capability to store the produced energy for satisfying a user's future demand. In this paper, the main objective is to determine the best strategies of energy consumption and optimal storage capacities for residential users, which are both closely related to the energy cost of the users. Energy management with storage capacity optimization is studied by considering the cost of renewable energy generation, depreciation cost of storage and bidirectional energy trading. To minimize the cost to residential users, the non-cooperative game-theoretic method is employed to formulate the model that combines energy consumption and storage capacity optimization. The distributed algorithm is presented to understand the Nash equilibrium which can guarantee Pareto optimality in terms of minimizing the energy cost. Simulation results show that the proposed game approach can significantly benefit residential users. Furthermore, it also contributes to reducing the peak-to-average ratio (PAR) of overall energy demand.