SummaryThe underwater acoustic sensor network is a fundamental source for ocean exploration. The potential applications of underwater acoustic sensor network (UASN) include seismic imaging, disaster prevention, mine reconnaissance, pollution monitoring, exploration of natural resources, and military surveillance. To acquire accurate results, implementing all applications of underwater sensor networks requires an adequate network connection and communication technology. The precise placement of underwater sensor nodes needs to be identified in order to achieve effective communication. To accomplish the requirement, the paper presents an efficient localization algorithm to compensate the stratification effect based on an improved underwater salp swarm optimization technique (LAS‐IUSSOT). To compute the location of sensor nodes with high accuracy, the nodes are initially randomly deployed in three‐dimensional underwater acoustic sensor network (3D‐UASN). After that, the hybridization of centroid‐based localization and the ray theory technique is used, and then, the degree of coplanarity is analyzed among the underwater sensor nodes. Then, the computation of the location of unknown nodes is performed using improved underwater salp swarm optimization technique (IUSSOT) to obtain the optimized location and compensate the impact of the stratification. The comparison of the simulation results of the existing algorithm and the proposed algorithm is performed. The LAS‐IUSSOT achieves 40.46% and 28.00% accuracy in terms of localization of underwater sensor nodes for both the sparse and dense regions in 3D‐UASN. The LAS‐IUSSOT achieves 49.39% and 62.57% accuracy in terms of ranging of underwater sensor nodes for both the sparse and dense regions in 3D‐UASN. Simulation results illustrate that the proposed algorithm outperforms the existing algorithm in terms of localization and ranging accuracy in both sparse and dense regions in 3D‐UASN, root mean square error (RMSE), normalized localization error (NLE), computation time, and convergence rate.