We study the interplay between the dynamics of a Bose-Einstein condensate in a double-well potential and that of an optical cavity mode. The cavity field is superimposed to the double-well potential and affects the atomic tunneling processes. The cavity field is driven by a laser red detuned from the bare cavity resonance; the dynamically changing spatial distribution of the atoms can shift the cavity in and out of resonance. At resonance the photon number is hugely enhanced and the atomic tunneling becomes amplified. The Josephson junction equations are revisited and the phase diagram is calculated. We find new solutions with finite imbalance and at the same time a lack of self-trapping solutions due to the emergence of a new separatrix resulting from enhanced tunneling.