Underwater wireless communications can be carried out through acoustic, radio frequency (RF), and optical waves. Compared to its bandwidth limited acoustic and RF counterparts, underwater optical wireless communications (UOWCs) can support higher data rates at low latency levels. However, the severe aquatic channel conditions (e.g., absorption, scattering, turbulence, etc.) pose great challenges for UOWCs and significantly reduce the attainable communication ranges, which necessitates efficient networking and localization solutions. Therefore, we provide a comprehensive survey on the challenges, advances, and prospects of underwater optical wireless networks (UOWNs) from a layer by layer perspective which includes: (1) Physical layer issues including propagation characteristics, channel modeling, and modulation techniques (2) Data link layer problems covering link configurations, link budgets, performance metrics, and multiple access schemes; (3) Network layer topics containing relaying techniques and potential routing algorithms; (4) Transport layer subjects such as connectivity, reliability, flow and congestion control; (5) Application layer goals, and (6) Localization and its impacts on UOWN layers. Finally, we outline the open research challenges and point out the prospective directions for underwater optical wireless communications, networking, and localization studies.