Osmotic energy represents a widespread and reliable source of renewable energy with minimal daily variability. The key technological bottleneck for osmotic electricity is that membranes must combine highly efficient ion rectification and high ionic flux with long-term robustness in seawater. Here, we show that nanocomposite membranes with structural organization inspired by soft biological tissues with high mechanical and transport characteristics can address these problems. The layered membranes engineered with molecular-scale precision from aramid nanofibers and BN nanosheets simultaneously display high stiffness and tensile strength even when exposed to repeated pressure drops and salinity gradients. The total generated power density over large areas exceeded 0.6 W m−2 and was retained for as long as 20 cycles (200 h), demonstrating exceptional robustness. Furthermore, the membranes showed high performance in osmotic energy harvesting in unprecedentedly wide ranges of temperature (0°C–95°C) and pH (2.8–10.8) essential for the economic viability of osmotic energy generators.