Due to the aquatic nature of communication in the underwater world, the underwater acoustic sensor network (UASN) is commonly used. However, it has inherent limitations, such as limited bandwidth, high transmission energy, long propagation delays, void regions, and expensive battery replacement. Improving network lifetime (NL) is the primary objective since replacing batteries in UWSN is very expensive and challenging. NL is improved by having a high packet delivery ratio (PDR), reduced dead nodes, and reduced energy consumption (EC). If two more node batteries are depleted, they become dead nodes, causing partitions on the network and resulting in a void region problem. Void regions occur when a node has no forwarder node to forward data packets toward the sink node. Void nodes affect the routing techniques’ overall performance regarding end‐to‐end delay (EED), data loss, and EC. So, the primary objective of this work is to avoid void regions. For the same, this paper proposes a void hole detection algorithm. The algorithm selects the best next hop node based on the fitness function calculated by the gray wolf optimization (GWO) algorithm, considering only the vertical directions despite horizontal directions, further reducing the EED. The proposed approach is simulated using MATLAB, and the evaluation is based on data broadcast copies, PDR, EC, dead node number (DNN), average operational time (AOT), NL, and EED. The paper has presented a comparison with weighting depth and forwarding area division depth‐based routing (WDFAD‐DBR) routing protocol for underwater acoustic sensor network (UASN) and energy and depth variance‐based opportunistic void avoidance scheme (EDOVS) for UASN. WDFAD‐DBR avoids void holes by selecting forwarding nodes and taking the weighting sum of depth differences of two hops; in comparison, EDOVS considers not only the depth parameters but also the normalized residual energy. The proposed paper contributes to developing an energy‐efficient routing algorithm that removes void nodes by selecting the appropriate forwarder node in void regions based on the GWO algorithm. The proposed work increases the network lifetime by avoiding void regions and balancing the EC. The simulation results show that the proposed algorithm gains more than 20% PDR, less EC, and 60% less broadcasted copies of data packets and has more NL than the WDFAD‐DBR, and 10% improved PDR and lesser broadcasted copies were sent than EDOVS along with the enhanced NL, by varying the transmission range the proposed algorithm showing the better performance in terms of EC, PDR, and DNN along with the values of 61.6, 0.97, and 35 (scenario node 60 and transmission range 600 m) and 64.1, 0.89, and 25, respectively, by variable network size.