Try settings > devices and devices > zha > configure, scroll down to the bottom and set both ‘consider mains powered…’ and ‘consider battery powered…’ to a much higher value. I set both mine to a year (in seconds). Haven’t had a problem with sensors (sonoff/aqara) dropping out since.
It seems to me it somehow has to do with sensors battery levels being reported to infrequently, making HA believe the entire sensor/device is offline. It seems it’s partially a bug and partially values that has to be tuned to match the most infrequent sensor in your mesh.
Another solution read elsewhere was to force the sensor to update it’s battery level more frequently. I don’t think it seems logical to force a sensor to keep reporting a value that hasn’t changed, so it seems more logical to lower HAs expectations.