This question was asked previously with respect to D&D 3.5:
There are some interesting answers there, but none of them were selected as the answer, and the monster has changed between editions. In particular, that question notes that Night Hag's CR was 9 in the previous edition, whereas currently they are CR 5. Presumably, a full-strength 5th level party of four adventurers should be able to defeat a Night Hag.
The Night Hag has the following action:
Nightmare Haunting (1/Day): While on the Ethereal Plane, the hag magically touches a sleeping humanoid on the Material Plane. A Protection from Evil and Good spell cast on the target prevents this contact, as does a Magic Circle. As long as the contact persists, the target has dreadful visions. If these visions last for at least 1 hour, the target gains no benefit from its rest, and its hit point maximum is reduced by 5 (1d10). If this effect reduces the target’s hit point maximum to 0, the target dies, and if the target was evil, its soul is trapped in the hag’s soul bag. The reduction to the target’s hit point maximum lasts until removed by the Greater Restoration spell or similar magic.
Let's assume that a 5th level party has already had a member suffer one night of Nightmare Haunting, and through player knowledge, role-played interactions, or Arcana checks, they've figured out they're facing a Night Hag and are expecting night two. Let's also assume they have all the knowledge of the Night Hag MM entry, knowledge of all the spells in the PH (and a mix of caster's who can prepare any spell up to 3rd level), and no magic items.
Contact can be "prevented" by:
- Protection from Evil and Good, which is 1st level, but only lasts 10 minutes.
- Magic Circle, which is 3rd level, and lasts an hour.
But since the Night Hag can come any time during the night, it's not clear that these spells are helpful. Magic Circle lasts longer if cast at higher level, but it doesn't help our 5th level party, and depending on your DM's sleep rules (not well-covered in RAW), may not be helpful until you get to an 8th or 9th level slot.
So in order to "prevent" contact, you wait for the Night Hag to arrive, then you cast the spell. But how does the party even know the Night Hag is there? See Invisibility can be used to see ethereal creatures, but it only lasts an hour, and the Night Hag can come any time during the night.
Then, if the party realizes the Night Hag is there but the Nightmare Haunting hasn't started, a spellcaster casts Protection from Evil and Good or Magic Circle. So the Night Hag goes away, and comes back after the spell expires. Repeat until no more spell slots, or at least deprive most of the party of their long rest.
So the party realizes it's fruitless to drive the Night Hag off before the Nightmare Haunting has begun. The spellcaster waits for the Night Hag to begin Nightmare Haunting a sleeping party member, then casts Protection from Evil and Good or Magic Circle. The Night Hag's 1/day power is spent. But do these spells even work? It's not clear to me that "prevented" means "stops" in this context. (And what does Magic Circle even do if you cast it on an area that already contains an excluded creature?)
In fact, the Night Hag still seems pretty challenging for higher level parties when used this way. Greater Restoration at least removes reduction of HP maximum, but killing the long rest can allow the Night Hag to systematically weaken a party. Etherealness lasts 8 hours and will eventually allow the party to post a sentinel in the Ethereal Plane (and hope the Night Hag doesn't kill the sentinel).
Please help before I TPK my players.