Practise makes perfect, you will have to learn to anticipate when the ships will fire at you.
Before using this method I could barely sink 2 galleons, with this method I managed to get the 3rd all-time score in this mini-game. Keep this up long enough and you will eventually sink 3 galleons. Using this method it's hard to aim your shots, but at least you stay alive. After the volley get ready to start moving again because chances are a cannonball will be shot towards you again. Since the canonballs move faster you can avoid them and then quickly volley the ball. The trick is to wait till a ship fires 1 or 2 cannonballs and 1 or 2 tennisballs. What worked for me was to position yourself on the serviceline, and moving from left to right and vice versa. At that time the cannonballs move so fast that you don't have time to line up a normal shot. The galleons require 4 hits to sink, they start to appear once you have about 5.000 points. Each ship has a different size healthbar, either 1, 2, 3 or 4 hits with a tennisball are required to sink them.
There are 4 types of ships in this game who each shoot tennisballs and/or cannonballs at you.
In this mini-game you have 5 lives, each time you get hit by a cannonball you lose one. Load up a game of Pirate Wars from the Play menu and sink 3 galleons.