Any way to reboot device programmatically without root? I don't switch off mobile phone at night. After several weeks of uptime my mobile phone becomes slow. When I reboot it everything is smooth again.

It's not possible to root my android 5 phone, there is no custom firmware, and no current one-click-root bugs. I would like to reboot my mobile every night while charging (wireless charger), but I have not found a way to do that. I could even write an app for that if it's somehow possible.

Is there any "legal" way to reboot phone programmatically? Maybe "device administrator" app permissions can help?

Thanks
You could use AutoInput with Tasker. 
AutoInput can create list with recorded screen touches for reboot, and with Tasker you can schedule action at the time you want, without root access.