Functionally, except for a few fish (e.g., lungfish, albacore) whose swim bladders have a respiratory function, the swim bladder is a body specific gravity regulating organ for most fish, which helps to regulate the body's buoyancy and sinking by means of changes in the gases inside the swim bladder.
Most bony fishes have a swim bladder, a long, thin sac located at the back of the body cavity. The swim bladder is usually divided into two chambers and contains oxygen, nitrogen, and carbon dioxide. The swim bladder is connected to the esophagus by a swim bladder tube called the laryngeal swim bladder, which belongs to the swim bladder of lower bony fishes, such as the carp. A swim bladder without a tube is called a closed swim bladder and belongs to higher bony fishes such as perch.
Expanded Information
The swim bladder is located dorsally in the body cavity of the fish, and has a tough, impermeable wall containing guanine crystals and very little vascular tissue. The degree of development of the swim bladder is related to the habits of the fish: fish that live in very shallow water and benthic habitats generally have less developed swim bladders because they don't need to float or sink, and tuna, for example, don't have well-developed swim bladders because they need to swim fast. Many cartilaginous fish, including sharks, regulate their buoyancy by swimming only.
The swim bladders of shallow-water fish have a gas composition similar to that of air. Deep-sea fish, on the other hand, generally contain more oxygen than air. Different levels of inflation in the swim bladder result in changes in volume and specific gravity of the entire fish body. The main function of the swim bladder is to lower the specific gravity of the fish in the water.
During the embryonic period, the swim bladder is formed by the protrusion and enlargement of the alimentary canal and is connected to the alimentary canal via the swim bladder tube. Fish with passive swim bladders (also known as laryngeal swim bladders, physostomous) retain their swim bladder tubes throughout their lives and inflate them by swallowing air through their mouths, such as carp and herringiformes.
Closed-bladder (physoclistous) fish, such as the perch, lose their swim bladder tubes and secrete lactic acid through specialized glands to collect oxygen from the bloodstream into the swim bladder. The latter are more likely to rupture the swim bladder in a rapidly rising fish because they exhaust more slowly.
Baidu Encyclopedia - Fish Swim Bladder