Why the usual fixes cost battery
HyperOS saves battery by freezing apps you aren't using. A frozen app can't receive messages, so notifications arrive late or only when you unlock the phone. Many people on HyperOS 3 and 4 see this, most of all on China ROM phones: imported Xiaomi phones, China-only models like the Redmi K series, and phones with a flashed China ROM.
The common advice works by letting apps run more: set every chat app to No restrictions, lock apps in Recents, or install a helper that keeps apps running all the time. Each step costs battery, and together you trade a lot of battery for notifications that still aren't always on time. Here is a lighter way.
Step 1: Use Balanced mode for everyday use
Open Settings → Battery → Current mode. Xiaomi says the phone-wide Battery saver mode freezes apps in the background, so use Balanced day to day. Switch to Battery saver or Ultra only when you really need to stretch the battery.
Don't mix this up with the per-app option called Battery saver (recommended). That one is fine to keep.
Step 2: Keep your apps on Battery saver (recommended)
Every app has its own battery setting. On China ROM phones it's in the Security app (Security → [app] → Power on HyperOS 4). On Global ROMs, long-press the app's icon and tap App info → Battery saver. Choose Battery saver (recommended), Xiaomi's default.
No restrictions lets an app run freely in the background, and the cost adds up with every app you set. See does No restrictions drain battery for the details.
Menu names change with version and region. If you can't find it, search Settings for "battery saver".
Step 3: Turn on Autostart only for apps you need messages from
Go to Settings → Apps → Permissions → Background autostart and turn it on for chat, email and work apps. Xiaomi itself advises keeping Autostart on for apps you need notifications from.
Autostart only lets an app start itself. It costs something only when the app then does work, so leave it off for games, shopping apps and anything you don't need to hear from.
Step 4: Skip Recents locks and check the basics
Locking an app in Recents keeps it running all the time, which uses memory and battery. For notifications you don't need it. See should you lock apps in Recents.
Then make sure the app may notify you: Settings → Notifications & status bar → App notifications → [app]. Check that Do not disturb and Data saver are off when you expect messages.
Step 5: Stop the freezing with HyperKeep
The steps above can't protect Google Play services, which delivers push messages for most apps and has no battery switch you can change. That's the gap HyperKeep fills. It's a free app made for China ROM phones.
HyperKeep adds the apps you choose, starting with Google Play services, to Xiaomi's list of apps it never freezes. Xiaomi rewrites that list now and then, for example when you install an app, and HyperKeep puts your apps back in about 2 seconds. No root, no ADB, one switch per app.
HyperKeep sleeps until it's needed. Android wakes it only when Xiaomi changes its list, and each fix takes a few milliseconds. Only HyperKeep needs No restrictions and Autostart, so all your other apps can stay on Battery saver (recommended), with no Recents locks. Download HyperKeep and follow the setup guide.
To check your ROM, open Settings → About phone and look at the HyperOS version. If the letters near the end contain "CN" (like OS4.0.6.0.XPKCNXM), you have the China ROM.
What about messages at night?
Late at night, HyperOS lets the phone rest more deeply to save battery, and no app can change that. With the steps above, late messages become much rarer, and anything that does wait arrives as soon as the phone wakes. If some messages matter at night, keep the phone in Balanced mode on a stable connection. More in notifications late at night.