Gamma-Hydroxybutyric acid (HBA) has been banned by the Food and Drug Administration (FDA) due to its extensive use in sexual assaults. HBA must be detected in biological media through effective methodologies. This paper evaluated the feasibility of exploiting pristine and Pt-decorated BC2N nanosheets in HBA detection using density functional theory (DFT). HBA molecules were found to be adsorbed onto BC2N, with an adsorption energy of -52.1 kJ/mol. The space around N atoms on the adsorbent and drug is a major determinant of the interaction (particularly the steric hindrance effect). The pristine BC2N nanosheets showed a poor tendency to adsorb HBA, with a negligible response of 5.3 at 298 K. The Pt atom, on the other hand, strongly adsorbed the HBA through its C head, releasing − 151.2 kJ/mol of adsorption energy and inducing a sufficiently long distance from the N atom on account of smaller crowding. The BC2N nanosheet facilitated the adsorption of HBA onto Pt through the O head of HBA molecules, with an adsorption energy of -151.2 kJ/mol. Therefore, the adsorption mechanism was concluded to be chemisorption. The decoration of BC2N with Pt remarkably enhanced its HBA sensitivity and provided a reactivity of 340.7, which would be explained by the major charge transfer from the adsorbate to the adsorbent. A recovery time of 4.9 s was predicted for the desorption of HBA from Pt@BC2N. Thus, Pt decoration enabled BC2N nanosheets to be a promising HBA nanosensor.