Many people opt to receive message notifications on their phone, so they can log in and reply when it suits them. The downside is that messages can sometimes arrive late at night and disturb your sleep.
Both iOS and Android phones have a built-in Do Not Disturb mode that silences notifications. You can schedule it to turn on and off automatically, so your phone stays quiet overnight without you having to remember to switch it on each evening. Most phones also let you allow calls from specific people to come through, so you won't miss anything urgent.
The exact steps vary depending on your phone and software version, but you'll usually find these settings under Settings > Focus on iPhone or Settings > Sound (or Sound & vibration) on Android.
For full step-by-step instructions, see: