The problem with the pirates is not that the various navies of the world lack adequate weapons to defeat them. It is, again, that the usual way of dealing with this, namely that governments prevent pirates from operating from their shores by treaty with other nations, does not work, because Somalia has no government that can control the pirates. The Somali government is sometimes outgunned, and at other times unconcerned with enforcing existing treaties. Because Somalia lacks an effective government and a navy, they waters off the coast have been overfished and the fishermen cannot catch fish as they once did, so many have turned to piracy out of desperation.
The commercial and private ships sailing in this very large area are outgunned by the pirates. Usually, such vessels only have a few firearms aboard. The pirates are hard to control effectively because the area is immense, and it is impossible to patrol all points effectively.
They could organize convoys of vessels going both north and south through the area, each accompanied by one or more warships, but this might slow commerce too much to make it cost effective.