The role of energy storage technology is gaining momentum as prosumers are actively participating in the retail electricity market. For the local energy community equipped with a grid-tied rooftop photovoltaic (PV) system, battery energy storage (BES) is a vital element to overcome the reliability issues occurring due to intermittency in renewable energy sources (RES). The PV-BES combination at the residential level is quite challenging as it involves optimal sizing and economical operation of the system. Also, rechargeable batteries are prone to aging and are majorly affected by temperature, state-of-charge (SOC), and charge/discharge rates (Crate), resulting in degradation and shortened useful life of BES. To this end, a single-objective optimization for minimizing the total degradation cost of BES is presented. In the first phase of this work, the day-ahead solar insolation is forecasted with an outlier filter-based autoencoder long short-term memory (LSTM-AE) for enhanced prediction accuracy. The mean absolute error (MAE), mean bias error (MBE), and coefficient of determination (R) of the LSTM-AE model are found to be 0.0423, −0.0117, and 0.984 respectively. The emergency demand response program (EDRP) is modeled in the second phase. An incentive of 20 ₵/kWh is found to balance the service provider (SP) revenue and prosumer benefit (PB) for prosumer participation in EDRP. Furthermore, the degradation cost of BES with an initial status of 20%, 55%, and 95% of SOC is optimized using a tuned gbest-guided artificial bee colony (GABC) algorithm both in the absence and presence of EDRP. The optimal solution obtained with EDRP shows daily savings, with three initial status of SOC, to be 18.78%, 12.14%, and 11.18% for summer, 16.15%, 13.77%, and 8.88% for mild, and 20%, 15.65%, and 12.16% for winter respectively, when compared without EDRP. Hence, this study demonstrates the merits of planning and prosumer participation in the retail electricity market and has a potential application in the real local energy community. The grid-connected PV-BES residential system is implemented in Python-Jupyter Notebook and MATLAB.