A search for four-top-quark production, tt¯tt¯, is presented. It is based on proton-proton collision data with a center-of-mass energy s=13 TeV collected by the ATLAS detector at the Large Hadron Collider during the years 2015 and 2016, corresponding to an integrated luminosity of 36.1 fb-1. Data are analyzed in both the single-lepton and opposite-sign dilepton channels, characterized by the presence of one or two isolated electrons or muons with high-transverse momentum and multiple jets. A data-driven method is used to estimate the dominant background from top-quark pair production in association with jets. No significant excess above the Standard Model expectation is observed. The result is combined with the previous same-sign dilepton and multilepton searches carried out by the ATLAS Collaboration and an observed (expected) upper limit of 5.3 (2.1) times the four-top-quark Standard Model cross section is obtained at 95% confidence level. Additionally, an upper limit on the anomalous four-top-quark production cross section is set in the context of an effective field theory model.