Viber, like any other application, uses SYNC feature. This means that the user does not necessarily need to be online since SYNC is used to check for new messages and calls and because of that it may show him as being online sometimes. However, if the process repeats every night, it's possible that he actually is online or there's an error with the Viber servers. Try updating the application.