The gas bladder is a gas-filled sac located in the dorsal portion of the fish. It has flexible walls that contract or expand according to the ambient pressure. The walls of the bladder contain very few blood vessels and are lined with guanine crystals, which make them impermeable to gases. In physostomous gas bladders, a connection is retained between the gas bladder and the gut, allowing the fish to fill up the gas bladder by "gulping" air and filling the gas bladder through the pneumatic duct. In more derived varieties of fish, the bladder has a gas gland that can introduce gases (usually oxygen) to the bladder to increase its volume and thus increase buoyancy. To reduce buoyancy, gases are released from the bladder into the blood stream and then expelled into the water via the gills. In order to introduce gas into the bladder, the gas gland excretes lactic acid; the resulting acidity causes the hemoglobin of the blood to lose its oxygen, which then diffuses into the bladder while flowing through a complex structure known as the rete mirabile. Elsewhere, at a similar structure known as the oval window, the bladder is in contact with blood and the oxygen can diffuse back.
Physoclist gas bladders have one important disadvantage: they prohibit fast rising, as the bladder would burst. Physostomes can "burp" out gas, though this complicates the process of re-submergence. Gas bladders are only found in ray-finned fish, but a few of these fish that do not need to change water depth have lost them. Many cartilaginous fish, including sharks, can control their depth only by swimming (using dynamic lift); others store fats or oils for the purpose.
In some fish, mainly freshwater species, the gas bladder is connected to the labyrinth of the inner ear by the Weberian apparatus, which provides a precise sense of water pressure (and thus depth), and may also improve hearing.
The combination of gases in the bladder varies; in shallow water fish, the ratios closely approximate that of the atmosphere, while deep sea fish tend to have higher percentages of oxygen. For instance, the eel Synaphobranchus has been observed to have 75.1% oxygen, 20.5% nitrogen, 3.1% carbon dioxide, and 0.4% argon in its gas bladder.
Gas bladders are evolutionarily closely related (i.e. homologous) to lungs. It is believed that the first lungs, simple sacs that allowed the organism to gulp air under oxygen-poor conditions, evolved into the lungs of today's terrestrial vertebrates and into the gas bladders of today's fish. In embryonal development, both lung and gas bladder originate as an outpocketing from the gut; in the case of gas bladders, this connection to the gut continues to exist as the pneumatic duct in more "primitive" teleosts, and is lost in the more derived orders. There are no animals which have both lungs and a gas bladder.