Abstract MoS2 a two-dimensional transition metal dichalcogenide (TMD), has garnered significant interest for its promising applications in semiconductors and solar cells due to its unique photovoltaic properties. This work investigates the role of MoS2 layers in enhancing solar cell performance, with a focus on layer optimization through both simulation and experimental validation. Using the SCAPS-1D simulation tool, we analyze and optimize key parameters such as layer thickness, defect density, band gap, temperature, and buffer layer, aiming to maximize photovoltaic performance. The impact of these parameters on critical performance metrics including power conversion efficiency (PCE), open-circuit voltage (Voc), short-circuit current density (Jsc), and fill factor (FF) is examined. Simulation results are compared with experimental data, highlighting key discrepancies and confirming the accuracy of the model. The study reveals that optimal layer parameters, including a thickness of 50 nm, acceptor density of 100x1018 cm⁻³, band gap of 1.2 eV, and a temperature of 300 K, result in a significant boost in solar cell efficiency. With these optimal parameters, the PCE reaches 21.06%, demonstrating a clear path toward high-performance solar cell design. This research bridges theoretical simulations and practical applications, offering valuable insights into the design and optimization of MoS2-based solar cells.