A search for the rare decays $B_s^0\toτ^+τ^-$ and $B^0\toτ^+τ^-$ is performed using proton$-$proton collision data collected with the LHCb detector. The data sample corresponds to an integrated luminosity of 3fb$^{-1}$ collected in 2011 and 2012. The $τ$ leptons are reconstructed through the decay $τ^-\toπ^-π^+π^-ν_{τ}$. Assuming no contribution from $B^0\toτ^+τ^-$ decays, an upper limit is set on the branching fraction $\mathcal{B}(B_s^0\toτ^+τ^-)