A search is described for a Higgs boson decaying into two photons, one of which has an internal conversion to a muon or an electron pair (llγ). The analysis is performed using proton–proton collision data recorded with the CMS detector at the LHC at a centre-of-mass energy of 8 TeV, corresponding to an integrated luminosity of 19.7 fb−1. The events selected have an opposite-sign muon or electron pair and a high transverse momentum photon. No excess above background has been found in the three-body invariant mass range 120<mllγ<150 GeV120<mllγ<150 GeV, and limits have been derived for the Higgs boson production cross section times branching fraction for the decay H→γ⁎γ→llγH→γ⁎γ→llγ, where the dilepton invariant mass is less than 20 GeV. For a Higgs boson with mH=125 GeVmH=125 GeV, a 95% confidence level (CL) exclusion observed (expected) limit is 6.7 (View the MathML source5.9−1.8+2.8) times the standard model prediction. Additionally, an upper limit at 95% CL on the branching fraction of H→(J/ψ)γH→(J/ψ)γ for the 125 GeV Higgs boson is set at 1.5×10−31.5×10−3.