November-March is the comfortable window; summer is extremely hot. Book the stay first, then the flight. Four to five nights covers Downtown and one beach day.
November-February is cooler and drier. Give yourself four to five nights and stay near BTS or MRT – the commute matters more than a slightly cheaper room.
May-September is milder. Book the hotel early; flights are easier to move than the stay. Three to five nights works if you pick a neighborhood you can walk.