Magic Circle and Protection from Good and Evil
If the Hag always finds the party about the same time of night, they could cast either in preparation for the hag to keep the Hag out. Protection would be better, as the Hag might forget to detect magic and waste the casting on an attempt to touch someone who is already protected.
Protection from Evil and Good is only an action to cast, so it can be cast easily even when the attack has started.
[W]hat does Magic Circle even do if you cast it on an area that already contains an excluded creature?
Traps the creature inside. The spell says:
When you cast this spell, you can elect to cause its magic to operate in the reverse direction, preventing a creature of the specified type from leaving the cylinder and protecting targets outside it.
So could trap the Hag -- but the problem here is that the casting Magic Circle takes 1 minute. Unless the DM allows you to hold completion of a spell similar to a ready action -- But that isn't RAW.
Oil of Etherealness
Applying the oil takes 10 minutes, and it lasts 1 hour. It will allow you to be on the ethereal plane. If you fight and break the touch the Hag, the Haunt attack is used for the day. If you secure the Heartstone, she can't get back to the ethereal plane, and if you kill the Hag, she'll be banished back to Hell.
Turn the Hag
Paladins of the Oath of Devotion's Turn the Unholy works when the Hags enters the material plane to attack.
Paladins of the Oath of Ancient's Turn the Faithless doesn't require Sight, if the Fey or Fiend hears the chanting they have to flee.
Paladins for the Oath of Vengeance can frighten a fey or fiend they see using Abjure Enemy.
Force Damage Won't Work, but Things of Force Do
A traveler on the Ethereal Plane is invisible and utterly silent to someone on the overlapped plane, and solid objects on the overlapped plane don't hamper the movement of a creature in the Border Ethereal The exceptions are certain magical effects (including anything made of magical force) and living beings.
However closer reading is that things made out of magical force hamper movement -- force damage doesn't pass through realms. This is made clear by a tweet from Jeremy Crawford:
https://twitter.com/JeremyECrawford/status/745062527118123009
No general rule causes force damage to pass from one plane of existence to another. #DnD
So while Magic Missle or Eldritch Blast won't help, the following will:
- Leomond's Tiny Hut
- Wall of Force
- Force Cage
Wake the Sleeper Will Not Work
Originally I thought that waking the sleeper would work. I said:
Simple answer are typically missed.
Always keep one party member on watch. If someone always keeps watch
(changing shifts so everyone gets full rest) they can look for party
members having nightmares. Having a nightmare of terrifying images
isn't a quiet thing -- ask any parent. Try putting the people with
highest perception on watch at the times you're most vulnerable, like
the middle of the night.
Once awake, the nightmare ends. If caught before an hour, the negative
effects don't take hold. The ability only works on sleeping people on
the material plane. The hags "Nightmare Haunting" is used up for for
that 24 hours.
However, RAI based on this tweet from Mike Mearls, that isn't the way it works. The victim only has to be asleep to start the nightmare haunt, but waking doesn't end it.
Alarm Won't Tell You She's coming
I thought Alarm might give you some warning, but its effect appears to be limited to the material plane. (Unless you cast it while in the Ethereal?)
How we handled it in our first campaign.
We never did get rid of that !@%#*! Night hag, so every night a couple of us (to include my Cleric) slept in the same room or place as the Bard (that is who the Hag had a grudge against) and when the hauntings began (evidenced by the Bard's reaction to the night mare) my cleric would cast protection from evil. I had to be sure to always save a 1st level spell slot for this. (What this basically did for our party is reduce how many first level slots I could cast by 1 on some adventure days, depending upon when the haunting happened over the night, early watch or late watch).
That was how our DM ruled it: contact initiated, respond with protection from evil spell, contact broken. I did not find any conflict with the book when I dug into it later.
I twice tried to trap her with a Magic Circle, but in neither case did it work, I think due to the Hag figuring out what I was doing and staying on the Ethereal Plane. So we stopped trying that. I was not on the same plane of existence as the Hag.
We were not high enough level for anyone to turn Ethereal and attack her, so the Hag was a great frustration to the party. When the game went dormant (around level 6) we still had not solved the Hag problem, and had burned some loot/gold on a greater restoration spell for the Bard to get him back up to scratch.
Why this ruling makes sense
Had the DM ruled that the protection from evil spell would not disrupt the contact, this haunting would have been a case of an "easy button" killing of the bard with nothing a level 5 party could do to stop it.
The Paladin(Vengeance), the Wizard(Transutation) and I (Tempest Cleric) were discussing a variety of ways to try and contact the Hag to make a deal to get her to stop bothering the Bard, or to try and trap her, but we ended up in some other adventures before we could get that plan to crystalize. Then the game went dormant due to RL.
Leomund's Tiny Hut (ritual)
If you have an arcane caster who has Leomund's Tiny Hut, it can be cast as a ritual and prevent access by the Hag.
I'd need to go back to game logs for this, but I think once or twice we slept in the Bard's Leomund's Tiny Hut and didn't get the haunting. Having to save a 3rd level spell for that every day/night (for a level 5 and then level 6 party) was a larger resource debt than we wanted to pay, though it was effective). At the time, the ability to cast LTH (ritual) by the Bard (and not burn a slot) went un-noticed. (Thanks for making that point, @markovchain).
Best Answer
If night hag maintains contact for 1 hour: three or four issues
No benefit from the long rest. What are the benefits of a long rest? From the rules on resting:
But what about spells?
From the cleric's class description, under Preparing and Casting Spells:
Regaining all expended spell slots looks like a benefit of a long rest. The prayer and preparation to change what is prepared are contingent on there being spell slots that need to be filled with spells: if the cleric has no spell slots regained, it is irrelevant to spend time in prayer changing the spells that are in those (non existent) slots.
I'd suggest that you discuss this with your DM to get their ruling. One could read the resting rule benefits as being confined to the Hit Dice/Hit Points recovery. If that is the ruling, then the preparation / change can go as spelled out in the same paragraph of the rules:
By this text, the ability to change what spells you have prepared for your spell slots is a benefit of the long rest.