Electronic coherences resulting from molecular photoionization underlie the process of attosecond charge migration, widely investigated as a possible path towards controlled charge-directed reactivity1–4. However, photoionization often creates entangled ions and photoelectrons. This entanglement compromises the ability to explore coherent ultrafast electron dynamics within ions or of their accompanying photoelectrons5–8. Here we present experiments and calculations in which hydrogen molecules are ionized by the combination of a phase-locked pair of isolated attosecond laser pulses and a few-cycle near-infrared (NIR) laser pulse. The electronic coherence in the dissociating H2+ ion is influenced by ion–photoelectron entanglement. We demonstrate experimental control over the degree of entanglement by varying the delay between the two attosecond pulses and the delay between these pulses and the few-cycle NIR pulse. Our work demonstrates the importance of proper consideration of the role of quantum entanglement for the optimal observation of electronic coherences in attosecond experiments.