The question of should you wear underwear to bed gets asked a lot and the honest answer is: it depends on the person and the underwear. From a health standpoint, sleeping without underwear allows for better ventilation, which most medical commentary supports as a positive for overnight comfort. But for blokes who prefer wearing something to bed, the main consideration is whether the underwear they're wearing is suitable for sleep: loose enough to allow movement, breathable enough not to create heat build-up, and comfortable enough to wear for 7 or 8 hours without causing pressure or restriction.
What I think matters most when deciding should you wear underwear to bed is the quality and type of the underwear you'd be wearing. A pair of tight, synthetic underwear worn overnight is probably worse than sleeping without anything. A pair of quality cotton boxer briefs or loose-fitting trunks in breathable fabric is a reasonable choice for blokes who prefer coverage during sleep. The fabric decision is more important than the yes or no answer to the question.
I've gone back and forth on this myself over the years. My honest experience is that quality cotton underwear worn to bed doesn't create any discomfort issues if the fit isn't restrictive. Tight or synthetic options do. I landed on wearing a light cotton option on cooler nights and nothing during summer. The key variable for me was always the fabric. When I switched to Barramundies cotton options, the occasional overnight wear stopped being something I had to think about.
From my experience, the should you wear underwear to bed question is less important than the what kind question. If you choose to wear something, make it breathable, make it quality cotton, and make sure it fits without restricting movement. If you choose not to, that's equally fine. Barramundies makes cotton underwear comfortable enough that the choice to wear it overnight is a reasonable one. Beyond that, it's personal preference and nobody else's business.