Some folks insist that positioning the nest boxes lower than the roosting perches will solve the nest sleeping issue, but I've found that, at least in my own flock, it makes no difference.
Some hens just seem to insist on sleeping in the nest box. However, while some nest sleeping is taken up because a hen just likes sleeping there, some others do it for reasons you can mitigate.
One reason a hen will choose a night in the nest instead of the perch is to escape bullying at roosting time. Others will do it because they feel sick or weak. This latter requires intervention beyond simple discipline, it goes without saying.
This is a very common discipline problem, and if you rule out bullying and illness, the only sure-fire way to cure it is to block off the nests at night. I fashioned a gate out of steel field fencing, bent the top wires to resemble the top of a wire coat hanger, and it's very simple to hang it on a length of closet dowel installed above the nests.