There are many solutions to this, depending on the resources you have available to you.
If you've upgraded your ship's doors, then venting atmosphere in the sections of the ship that has boarders is a good tactic, provided they've boarded in the outer parts of your ship. The doors will stop them from retreating to other parts of the ship without blowing up the doors, while the exposure to open space will cause quite a bit of damage to them - leaving you to either vent the next compartment as they get through the doors or send a party to meet up with your attackers once they've gotten through the door.
Another tactic is to lead your attackers to your medical bay, and fight them in the medical bay. While fighting in your medical bay you can power up your medical bay and heal your fighters as quickly as they're being damaged, removing the risk of death from the attack. You can of course fight out in the open but eventually you will need to swap out your attackers and heal them up.
It's also worth noting that different types of crew have different statistics in battle. Mantis for example do additional damage, while having no negative effect to their health whilst Engi do half damage and will die very quickly. Ensure your attack party is made up of Mantis or Rockmen (which have more base health and are immune to fire) to provide yourself with the strongest attack party you can.