A search for the standard model Higgs boson produced in association with a top-quark pair is presented using data samples corresponding to an integrated luminosity of 5.0 fb−1 (5.1 fb−1) collected in pp collisions at the center-of-mass energy of 7 TeV (8 TeV). Events are considered where the top-quark pair decays to either one lepton+jets (tt¯→ℓνqq¯′bb¯) or dileptons (tt¯→ℓ+νℓ−ν¯bb¯) , ℓ being an electron or a muon. The search is optimized for the decay mode H→bb¯ . The largest background to the tt¯H signal is top-quark pair production with additional jets. Artificial neural networks are used to discriminate between signal and background events. Combining the results from the 7 TeV and 8 TeV samples, the observed (expected) limit on the cross section for Higgs boson production in association with top-quark pairs for a Higgs boson mass of 125 GeV is 5.8 (5.2) times the standard model expectation.