I have learned that two important lineages of fish are the bony fishes (Osteichthyes) and the cartilaginous fishes (Chondrichthyes). Many websites mention an advantage of the cartilaginous skeletons of sharks and other chondrichthyans: they're lighter than bony skeletons.
But it has been harder for me to find out if we know of any things bony skeletons do for fish that cartilage skeletons can't do, or don't do as well.
My research and hypotheses
I found an old Manual of Geology by Samuel Haughton (1865) that says
[a bony] skeleton only affords an advantage over a cartilaginous skeleton by allowing a greater variety of points of attachment for the muscles of the Fish, and so admits of more powerful motions.
But maybe other people have discovered more things since this was written. Also, I'm curious if this is just a theoretical argument, or if we have actual evidence that bony fish are capable of using their muscles more effectively than cartilaginous fish.
I have three main hypotheses at present:
Haughton was right, and a bony skeleton is just more effective at serving as an attachment point for muscles.
Bony skeletons are more effective at protecting the fish.
There are no advantages to bony skeletons; bony fish just happened to evolve this way. (As far as I can tell, the early evolutionary history of fish has been a bit unclear and I haven't been able to determine if there is current consensus about whether bone or cartilage skeletons came first, and whether chondrichthyan cartilage skeletons are an inherited primitive feature or an innovation.)