What do Online and Offline mean in Viber?
"Online" means that Viber is running in the foreground or background (the user is available for calls or messages). When the phone has no internet connection, or the user manually used the "Exit" option inside Viber, this changes their status to "Last online at..."

In some cases, depending on the mobile kernel and software, the user uses something like Power Saving Mode, so after the idle time, the Wifi is turned off or some background application is turn off ... so Viber is turned off, your bf's viber state is also offline.