Recently, underwater acoustic sensor networks (UASNs) have been proposed to explore underwater environments for scientific, commercial, and military purposes. However, long propagation delays, high transmission losses, packet drops, and limited bandwidth in underwater propagation environments make realization of reliable and energy-efficient communication a challenging task for UASNs. To prolong the lifetime of battery-limited UASNs, two critical factors (i.e., packet size and transmission power) play vital roles. At one hand, larger packets are vulnerable to packet errors, while smaller packets are more resilient to such errors. In general, using smaller packets to avoid bit errors might be a good option. However, when small packets are used, more frames should be transmitted due to the packet fragmentation, and hence, network overhead and energy consumption increases. On the other hand, increasing transmission power reduces frame errors, but this would result in unnecessary energy consumption in the network. To this end, the packet size and transmission power should be jointly considered to improve the network lifetime. In this study, an optimization framework via an integer linear programming (ILP) has been proposed to maximize the network lifetime by joint optimization of the transmission power and packet size. In addition, a realistic link-layer energy consumption model is designed by employing the physical layer characteristics of UASNs. Extensive numerical analysis through the optimization model has been also performed to investigate the tradeoffs caused by the transmission power and packet size quantitatively.