How does a planetary shield stop pirates from landing troops?
Couldn't say, although it is possible that assault pods count as a bombardment weapon. Alternatively, planetary shields may count as a shield with sufficient strength to be impenetrable to the boarding pod (if you examine the boarding pod descriptions, there is a line in there that refers to the maximum shield strength that the pods can penetrate).
I can nevertheless confirm that planetary shields do in fact appear to prevent raids, as I spawned a colony with a Planetary Shield in my starting system as a pirate and then gave myself about a dozen warships equipped with boarding pods, stuck them in a fleet, and ordered them to raid the planet. Despite the lack of troops on the planet and my ships making repeated passes over the world with 'raid planet' orders, no boarding pods were launched and no raiders appeared on the planet's surface.
Also, The pirate faction in my game is very powerful and protection only costs 165 cr a month. So it doesn't make sense for me to fight them. Is there any disadvantage in letting the pirate remain friends?
Paying the pirates 165 credits per month is about 2000 credits off your cashflow, and probably only covers the maintenance of one small pirate ship. This is nevertheless 2000 credits that you could be using to fund your own military, and 2000 credits that the pirate faction doesn't need to come up with from other sources. Long-term, you're better off building up a space navy and crushing all pirates (dead pirates can't go back on their agreements, after all), as protection agreements also give the pirates license to keep their warships hanging around at your colonies, which allows them to build up control at the planet and thus build hidden bases, hidden fortresses, and eventually criminal networks (although any world with more than a few billion inhabitants is more or less immune to pirate control, as at that population level passive gains in control from orbiting vessels are typically outstripped by natural reductions in control level due to the planet's populace); control also grants pirates some portion of the planetary income, which may siphon off some of your taxes and will help the pirates stay strong. Short-term, 2000 credits per year for 'protection' from a strong pirate faction isn't a bad deal, and may be worth maintaining until you've made your fleets ready to make a move against the pirate faction or until someone else cripples this group of pirates.
If you have protection agreement with pirates, Can you take out their bases?
Yes. As with any other entity, this will not necessarily cause your faction and the pirates to break off relations, but it may result in the cancellation of protection agreements as attacking or destroying ships and bases (including the hidden planetary bases) adds a malus to your relations rating with that pirate faction.