They can't hit you.... they can't suck your brains.
PfMW makes anything too easy.
Other than that, the best way to fight them is to protect yourself from stunning attacks. There are numerous ways to do that, Chaotic Commands, brine potions, greenstone amulets, Arbane's sword, Mazzy's sword, Keldorn's armor, ring of free action, potions of free action, etc.
Protecting against their stunning attack is half the battle. You can't protect yourself from their brain sucking (well PfMW is the only way) so you just have to kill them fast. Use haste, improved haste, whirlwind attack, etc.
Every time they hit you, your intelligence stat is drained to simulate them sucking your brain. If your intelligence hits zero, you die because the mind flayer just ate your brain. That is why mind flayers kill you in just a few points regardless of your hit points. So you just have to kill them very very fast like I said above.
You can also drink potions of intelligence to raise your intelligence temporarily. This makes it so that the mind flayers will have to hit you an extra time or two to kill you. Also, keep low intelligence characters like Minsc away from melee because their low intelligence means they will die very very quickly. Minsc dies in two hits from any mind flayer.
I forgot to mention you can use some summons too.. I forgot it because I am not a fan of using summons personally.
Summons like skeletons and mordy swords have no brains so they are immune to the brain sucking. Send them in to fight the mind flayers in melee while your other characters hang back and fight from range.
^ Yeah, mind flayers have bad THAC0, so you can easily get an AC low enough that the mind flayers don't hit on anything but a critical hit. The problem is that when you are surrounded by mind flayers, the chances of them getting criticals increases, so that is why you need to kill them off as fast as possible.
If you can prevent the stunning attack, then mind flayers are easy. Stunned enemies are automatically hit regardless of THAC0, so if a mind flayer stuns you, you are dead....
I heartily suggest following some Skeleton Warriors with a party sporting full ranged weapons. The skeletons are basically meant to hold the Ilithids at bay, while your party snipes them down one at a time.
Got me through the Underdark with something like 6 skeletons. No real worries.
Setzerdog: What do you use guns for? The 13th Lyricist: Sometimes me and my son want to play catch and don't have a Frisbee, so the guns come in handy.