Can I globally set all Android apps to prefer WiFi for data? My cellular carrier just alerted me that we've exceeded our data usage. They show that I used more than 500MB at once a few days ago at a time when I was at home in bed, and the phone in range of my WiFi. I assume the phone downloaded an update automatically, but there was no reason for it to use cellular data when WiFi was available.

The device is a Nexus 5 and it recently updated its OS. I don't have it nearby or I'd check the version.

Can I set an Android phone to always use WiFi, for all apps, if its available?
Android does this by default. If you have a connection to the internet via WiFi this will be used by all apps. Android Lollipop added the ability for it to revert to cellular data if the Wireless network you are connected to does not have a connection to the internet. This is signified by an exclamation mark (!) on the WiFi icon in the top right. More information on this can be found here