DC microgrids play a crucial role in both industrial and residential applications. This study focuses on minimizing output voltage ripple in a DC microgrid, including power supply resources, a stochastic load, a ballast load, and a stabilizer. The solar cell serves as the power supply, and the stochastic load represents customer demand, whereas the ballast load includes a load to safeguard the boost circuits against the overvoltage in no-load periods. The stabilizer integrates components such as electrical vehicle batteries for energy storage and controlling long-time ripples, supercapacitors for controlling transient ripples, and an over-voltage discharge mechanism to prevent overcharging in the storage. To optimize the charging and discharging for batteries and supercapacitors, a multi-objective cost function is defined, consisting of two parts—one for ripple minimization and the other for reducing battery usage. The battery charge and discharge are considered in the objective function to limit its usage during transient periods, providing a mechanism to rely on the supercapacitor and protect the battery. Particle swarm optimization is employed to fine-tune the fuzzy membership function. Various operational scenarios are designed to showcase the DC microgrid’s functionality under different conditions, including scenarios where production exceeds and falls below consumption. The study demonstrates the improved performance and efficiency achieved by integrating a PSO-based fuzzy controller to minimize voltage ripple in a DC microgrid and reduce battery wear. Results indicate a 42% enhancement in the integral of absolute error of battery current with our proposed PSO-based fuzzy controller compared to a conventional fuzzy controller and a 78% improvement compared to a PI controller. This translates to a respective reduction in battery activity by 42% and 78%.