SummaryMachine‐to‐machine (M2M) communications is one of the major enabling technologies for the realization of the Internet of Things (IoT). Most machine‐type communication devices (MTCDs) are battery powered, and the battery lifetime of these devices significantly affects the overall performance of the network and the quality of service (QoS) of the M2M applications. This paper proposes a lifetime‐aware resource allocation algorithm as a convex optimization problem for M2M communications in the uplink of a single carrier frequency division multiple access (SC‐FDMA)‐based heterogeneous network. A K‐means clustering is introduced to reduce energy consumption in the network and mitigate interference from MTCDs in neighbouring clusters. The maximum number of clusters is determined using the elbow method. The lifetime maximization problem is formulated as a joint power and resource block maximization problem, which is then solved using Lagrangian dual method. Finally, numerical simulations in MATLAB are performed to evaluate the performance of the proposed algorithm, and the results are compared to existing heuristic algorithm and inbuilt MATLAB optimal algorithm. The simulation results show that the proposed algorithm outperforms the heuristic algorithm and closely model the optimal algorithm with an acceptable level of complexity. The proposed algorithm offers significant improvements in the energy efficiency and network lifetime, as well as a faster convergence and lower computational complexity.