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 gamma). The analysis is performed using proton-proton collision data recorded with the CMS detector at the LHC at a centre-of-mass energy of 8TeV, 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 < m(ll gamma) < 150 GeV, and limits have been derived for the Higgs boson production cross section times branching fraction for the decay H -> gamma*gamma -> ll gamma, where the dilepton invariant mass is less than 20 GeV. For a Higgs boson with m(H) = 125 GeV, a 95% confidence level (CL) exclusion observed (expected) limit is 6.7 (5.9(-1.8)(+2.8)) times the standard model prediction. Additionally, an upper limit at 95% CL on the branching fraction of H -> (J/psi)gamma for the 125 GeV Higgs boson is set at 1.5 x10(-3). (C) 2015 CERN for the benefit of the CMS Collaboration. Published by Elsevier B.V. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/4.0/).