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 (). 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. 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 GeV, and limits have been derived for the Higgs boson production cross section times branching fraction for the decay , where the dilepton invariant mass is less than 20 GeV. For a Higgs boson with 125 GeV, a 95% confidence level (CL) exclusion observed (expected) limit is 7.7 (6.4) times the standard model prediction. Additionally, an upper limit at 95% CL on the branching fraction of for the 125 GeV Higgs boson is set at 1.510.