We demonstrate how noise can be turned into a resource for optical sensing using a nonlinear cavity. The cavity is driven by a continuous-wave laser into the regime of optical bistability. Due to the influence of fluctuations, the cavity switches randomly between two metastable states. By analyzing the residence times in these two states, perturbations to the resonance frequency of the cavity can be detected. Here, such an analysis is presented as a function of the strength of the perturbation and of the noise. By increasing the standard deviation of the noise, we find that the detection speed increases monotonically while the sensitivity peaks at a finite value of the noise strength. Furthermore, we discuss how noise-assisted sensing can be optimized in state-of-the-art experimental platforms, relying solely on the minimum amount of noise present in the cavity due to its dissipation. These results open up new perspectives for the ultrafast detection of nanoparticles, contaminants, gases, or other perturbations to the resonance frequency of an optical resonator, at low powers and in noisy environments.