In the Internet of Things (IoTs) and wireless sensor networks (WSNs), improving security and energy efficiency are key concerns. Clustering, which involves managing cluster heads, plays a pivotal role in extending network lifetime. The selection of a cluster head, responsible for data transfer between nodes, is a key aspect of network management. This paper proposes two variants of a novel algorithm designed for energy efficient communication in a resource constrained IoT environments. One variant considers remaining energy, distance, and node degree for cluster head selection, while the other focuses on remaining energy and distance only. Including node degree ensures cluster heads do not waste energy by remaining idle or performing unnecessary tasks such as the cluster head selection process in every round. The authors tested these variants against several well known algorithms using MATLAB simulation environment, evaluating factors such as operating nodes, number of clusters, transmission energy, and remaining energy. The proposed algorithm extends network lifetime by maintaining more operating nodes for longer, not changing clusters or cluster heads frequently, minimizing energy consumption for transmission, and conserving more remaining energy. Consequently, the proposed algorithm outperforms existing approaches by addressing issues like zero cluster head selection, compulsory cluster head selection in every round, avoiding cluster heads that connect to no nodes, and preventing network destabilization due to unnecessary re-elections.