SummaryInformation transmission is extremely challenging in underwater acoustic sensor networks (UASNs) because, in the acoustic channel, the packet loss is high compared to other channels due to low bandwidth and a long propagation delay. So, designing an efficient energy algorithm is a big challenge in the acoustic channel. In this paper, first, a cluster head (CH) election fitness function based on a hybrid particle swarm optimization and gravitational search algorithm (PSO‐GSA) is proposed for a three‐dimensional (3D) underwater sensor network (UASN). The proposed algorithm includes CH election, CH load, and neighbor CH distance for multi‐hop transmission (MH‐PSOGSA). Then, based on the proposed algorithm, a relay‐based traffic‐aware energy‐efficient routing protocol (R‐TAEERP) with a weight function is proposed to offload the heavy consumption of the CHs. MATLAB simulations were accomplished to compare the performance of MH‐PSOGSA and R‐TAEERP with the existing representative protocols. The heterogeneity in energy and traffic has been considered. The simulation results show better performance of the proposed algorithm than other existing representative protocols in terms of energy consumption, the performance of the stable region, and the lifetime of the network.