At night, a man’s penis becomes engorged with blood as a means of keeping it healthy. You may be familiar with the term morning wood. This is the penis stretching itself out and ensuring that it is functional and healthy. If the penis is confined in a cage it will certainly stretch out and become uncomfortable although no more uncomfortable during teasing or a daytime erection. Since nighttime erections are predictable, I highly recommend using Vaseline or Bag Balm around the base ring to help prevent chafing. This should ensure a good night sleep.
Many men report needing to wake up at 3 or 4 am every morning (depending on their sleep cycle) to urinate. That should relieve the erection and allow you to sleep through the rest of the night.