A search for the standard model production of four top quarks (pp → t t ¯ t t ¯) 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 t t ¯ t t ¯ from t t ¯ production. No significant deviation is observed from the predicted background. An upper limit is set on the cross section for t t ¯ t t ¯ 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−9+11 fb. The result is also interpreted in the framework of effective field theory.