The 2.4-m Thai National Telescope (TNT) is the main facility of the Thai National Observatory located on the Doi Inthanon, Thailand's highest mountain. The first astronomical images obtained at the TNT suffered from diffraction and stray light problems: bright spikes spread from bright stellar images over few arcminutes in the focal plane, and the images taken during observations in bright moon conditions were contaminated by high levels of stray light. We performed targeted investigations to identify the origin of these problems. In a first time, these investigations consisted of analyzing the irradiance distribution of defocused stellar images and of identifying the contributors. We concluded that these bright spikes around the bright stellar images were due to the chamfer and the wavefront error at the mirror edge. We thus installed an annular mask along the edge of the primary mirror that fully suppressed these spikes and we quantified the improvement by observing the double star Sirius. In a second time, we identified the contributors to the stray light by placing a pinhole camera at the TNT focal plane. Then, we designed a new baffle to improve the stray light rejection. The final design of the baffle comprises 21 diaphragms, is painted with an ordinary black paint and was designed, developed and installed on the TNT in less than 8 months. We assessed the improvement on the performance by measuring the variation of the stray light signal before and after installing the baffle in the telescope structure. These steps significantly improved the image quality and enhanced the rejection of the stray light at the focal plane level. In this paper, we present our investigations, we describe the method used to design the TNT baffle, and we present the improvement in quantitative terms.