This is a simple solution to prevent Android from going into deep sleep mode which causes random reboots on some ROMs.
Eg: Ivan’s lollipop ROM on Xiaomi Mi3
1. Install Wakelock app from https://play.google.com/store/apps/details?id=eu.thedarken.wl
2. Open the wakelock app and set it to Partial wakelock
3. In Options, check Start on boot option.