The objective of this study was to optimize, by employing a central composite rotatable design, and validate an analytical method to detect and quantify monoaromatic compounds (benzene, toluene, ethylbenzene, and xylenes) in waters and wastewaters by using headspace extraction followed by GC coupled with photoionization detection. The extraction parameters optimized were: salinity, sample volume, incubation time, and extraction temperature. The results revealed that the sample volume was the most significant parameter in the extraction process, whereas the salinity effect was negligible, which extends the applicability of the analytical method to waters with different salinities. Finally, the studied method was very selective and, at the optimal extraction conditions (15 mL sample volume, 15 min incubation time, and temperature of 70°C), presented excellent repeatability (<4%), linearity (R > 0.999 for each compound), and sensitivity, since very low LODs (0.13-0.48 μg/L) and LOQs (0.43-1.61 μg/L) were achieved.