Right click a campfire with an empty hand to set your spawnpoint next to it. It only works with lit campfires, and breaking the campfire will reset your spawnpoint.
Setting your spawnpoint to a campfire will not count as sleeping, as phantoms will continue spawning.

