A search for the rare decay of a $B^{0}$ or $B^{0}_{s}$ meson into the final state $J/psigamma$ is performed, using data collected by the LHCb experiment in $pp$ collisions at $sqrt{s}=7$ and $8$ TeV, corresponding to an integrated luminosity of 3 fb$^{-1}$. The observed number of signal candidates is consistent with a background-only hypothesis. Branching fraction values larger than $1.7times 10^{-6}$ for the $B^{0}to J/psigamma$ decay mode are excluded at 90% confidence level. For the $B^{0}_{s}to J/psigamma$ decay mode, branching fraction values larger than $7.4times 10^{-6}$ are excluded at 90% confidence level, this is the first branching fraction limit for this decay.