A search for the decays Bs0→e+e− and B0→e+e− is performed using data collected with the LHCb experiment in proton-proton collisions at center-of-mass energies of 7, 8 and 13TeV, corresponding to integrated luminosities of 1, 2 and 2fb−1, respectively. No signal is observed. Assuming no contribution from B0→e+e− decays, an upper limit of B(Bs0→e+e−)<9.4(11.2)×10−9 is obtained at 90(95)% confidence level. If no Bs0→e+e− contribution is assumed, a limit of B(B0→e+e−)<2.5(3.0)×10−9 is determined at 90(95)% confidence level. These upper limits are more than one order of magnitude lower than the previous values.