A swim bladder is for a fish as lungs are for human. The fish takes in oxygen from the water using its gills. There are also some species especially those in slow-moving waters gulp air at the surface. An example is lung fish. The lung fish has a swim bladder richly supplied with blood vessels and connected to the mouth. They are adapted for using oxygen in the air than that dissolved in water. They cannot survive if they do not take in oxygen regularly at the surface.
The swim bladder is also helpful in rising and sinking of fish inside the water. In order to ascend, the fish reduces its overall density by increasing its volume (density = mass per unit volume) without significantly increasing its mass. The swim bladder which is expandable is of help in this process. A fish fills the bladder with oxygen collected from the surrounding water via the gills. When the bladder is filled with this oxygen gas, the mass is not significantly increased but its volume is increased. Thus the overall density of the fish is reduced and the fish is able to rise to the surface. When the swim bladder is completely deflated, the fish has minimum volume and sinks to the ocean floor. To stay at a particular level, a fish fills its bladder in such a way that it displaces a volume of water that weighs what the fish weighs. This helps the fish to stay at that level. Thus swim bladder regulates the density and contributes to the ability of fish to control its buoyancy.
Only some species are known to use the swim bladder to rise and sink and not all. The swim bladder is not present in some bottom-dwelling and deep-sea bony fish and in all cartilaginous fish like sharks, skates, and rays.
Fish: Role of swim bladder
The lung fish has a swim bladder richly supplied with blood vessels and connected to the mouth. They are adapted for using oxygen in the air than that dissolved in water.