I think immigration queues make this impossible to answer. You could be through in five minutes but that's unlikely. It could quite easily also be 35 minutes. It's more than possible it could be more than an hour.
I'd aim to be at the terminal no less than 90 minutes before the flight. It's a big, spread-out airport with lengthy immigration queues. Anything less would be foolish.
As to what time to leave your hotel, that's even more difficult to answer. The reputation of traffic is Bangkok is well deserved. Getting a taxi from Silom or Sukhumvit could take 30 minutes or it could take 90 minutes (or more!). Public transport (i.e. trains) is far more reliable in this regard.
Whenever I have taken a taxi to the airport from one of those places, I aim to leave the hotel no later than 3.5 hours before departure time during rush hour and 3 hours before departure time during other time.