A search for direct top squark pair production is presented. The search is based on proton-proton collision data at a center-of-mass energy of 13 TeV recorded by the CMS experiment at the LHC during 2016, 2017, and 2018, corresponding to an integrated luminosity of 137 fb(-1). The search is carried out using events with a single isolated electron or muon, multiple jets, and large transverse momentum imbalance. The observed data are consistent with the expectations from standard model processes. Exclusions are set in the context of simplified top squark pair production models. Depending on the model, exclusion limits at 95% confidence level for top squark masses up to 1.2 TeV are set for a massless lightest supersymmetric particle, assumed to be the neutralino. For models with top squark masses of 1 TeV, neutralino masses up to 600 GeV are excluded.