A search for the standard model production of four top quarks (pp → tt¯tt¯) is reported using single-lepton plus jets and opposite-sign dilepton plus jets signatures. Proton-proton collisions are recorded with the CMS detector at the LHC at a center-of-mass energy of 13 TeV in a sample corresponding to an integrated luminosity of 35.8 fb−1. A multivariate analysis exploiting global event and jet properties is used to discriminate tt¯tt¯ from tt¯ production. No significant deviation is observed from the predicted background. An upper limit is set on the cross section for tt¯tt¯ production in the standard model of 48 fb at 95% confidence level. When combined with a previous measurement by the CMS experiment from an analysis of other final states, the observed signal significance is 1.4 standard deviations, and the combined cross section measurement is 13(+11/−9) fb. The result is also interpreted in the framework of effective field theory.