This study explores an innovative focus for optimizing clusters in the LEACH-C protocol via applying the P-Median model. Using a fixed number of sensors, the method is centered on improving energy efficiency for Wireless Sensor Networks (WSN). Applying the P-Median model managed to delay the death of the first node, reducing both the number of clusters and the number of packets sent to the cluster heads, increasing packets sent to the sink, and increasing average network energy. These advances represent a significant improvement in energy efficiency, a central aspect of WSN, also contributing to long-term sustainability and lowering operating and maintenance costs. The relevance of this study reaches beyond improvements in energy efficiency, presenting the potential to revolutionize resource and infrastructure management, especially in remote areas. The results of this study open a promising path towards optimization in the field of WSN and highlight the usefulness of the P-Median model in improving performance and energy efficiency within these networks.