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, 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) Potential network architectures; 2) Physical layer issues including propagation characteristics, channel modeling, and modulation techniques 3) Data link layer problems covering link configurations, link budgets, performance metrics, and multiple access schemes; 4) Network layer topics containing relaying techniques and potential routing algorithms; 5) Transport layer subjects such as connectivity, reliability, flow and congestion control; 6) Application layer goals and state-of-the-art UOWN applications, and 7) Localization and its impacts on UOWN layers. Finally, we outline the open research challenges and point out the future directions for underwater optical wireless communications, networking, and localization research.