We could probably stop piracy the same way we combatted the U-boat menace.
The US Navy was bitterly opposed to convoys back when the Krauts were last prowling the waves in earnest, and it took the sinking of a few million tonnes of shipping to change their minds.
If you put 30 or 40 ships into a convoy, you only need a few naval escorts to protect the lot. You don't need to have escorts steaming all over the ocean looking for pirates - all the juice is in one place - the convoy. You simply forget about the rest of the ocean, and whatever pirates might be sailing on it, and just concentrate on the bit of water surrounding the convoy. If we could protect convoys in WWII with trawlers armed with a 6-pounder cannon, I'm sure we can protect a modern convoy with one or two frigates.
Convoys date back to Napoleonic times, and naval captains and merchant captains have always hated them. The merchant captains hate being coralled into a herd and having to hold position in a convoy and sail at the speed of the slowest ship. Navy types hate having to herd fractious merchant prima-donna's.
Still, if the situation is serious enough, it will eventually make sense to both the shipping companies and the navies tasked with protecting the sea lanes. Unfortunately, the pirates will probably have to kill a bunch of people before that happens.