The use of an electrical energy storage system (EESS) in a microgrid (MG) is widely recognized as a feasible method for mitigating the unpredictability and stochastic nature of sustainable distributed generators and other intermittent energy sources. The battery energy storage (BES) system is the most effective of the several power storage methods available today. The unit commitment (UC) determines the number of dedicated dispatchable distributed generators, respective power, the amount of energy transferred to and absorbed from the microgrid, as well as the power and influence of EESSs, among other factors. The BES deterioration is considered in the UC conceptualization, and an enhanced mixed particle swarm optimizer (EMPSO) is suggested to solve UC in MGs with EESS. Compared to the traditional PSO, the acceleration constants in EMPSO are exponentially adapted, and the inertial weight in EMPSO decreases linearly during each iteration. The proposed EMPSO is a mixed integer optimization algorithm that can handle continuous, binary, and integer variables. A part of the decision variables in EMPSO is transformed into a binary variable by introducing the quadratic transfer function (TF). This paper also considers the uncertainties in renewable power generation, load demand, and electricity market prices. In addition, a case study with a multiobjective optimization function with MG operating cost and BES deterioration defines the additional UC problem discussed in this paper. The transformation of a single-objective model into a multiobjective optimization model is carried out using the weighted sum approach, and the impacts of different weights on the operating cost and lifespan of the BES are also analyzed. The performance of the EMPSO with quadratic TF (EMPSO-Q) is compared with EMPSO with V-shaped TF (EMPSO-V), EMPSO with S-shaped TF (EMPSO-S), and PSO with S-shaped TF (PSO-S). The performance of EMPSO-Q is 15%, 35%, and 45% better than EMPSO-V, EMPSO-S, and PSO-S, respectively. In addition, when uncertainties are considered, the operating cost falls from $8729.87 to $8986.98. Considering BES deterioration, the BES lifespan improves from 350 to 590, and the operating cost increases from $8729.87 to $8917.7. Therefore, the obtained results prove that the EMPSO-Q algorithm could effectively and efficiently handle the UC problem.