Branchiostegal lung

A branchiostegal lung is a respiration organ used by some air-breathing arthropods. It is one of the most significant adaptations of some crabs and hermit crabs such as the coconut crab to their terrestrial habitats.
The branchiostegal (gill) tissue is supported by folds or other mechanisms to increase surface area and are of a similar tissue to that normally found in gills. In this case, the lung is more suited to the absorption of oxygen from air, rather than water.
Instead of branchiostegal lungs, some terrestrial hermit crabs ("Coenobita" and "Birgus") possess multiple gills and small lungs, with other varieties of gas diffusion methods supporting the transition from aquatic to terrestrial dwelling.
The developmental shift from water diffusion "gills" to air perfusion "lungs" may have been related to the need for reduced rates of water loss in air.