Heavy neutral leptons (HNLs) have been proposed to extend the standard model to explain the MiniBooNE anomaly. We demonstrate that, in the minimal scenario, this model is ruled out by a combination of neutrino beam experiments and cosmological constraints. However, HNLs could be portals to a dark sector. An extension of this model that incorporates a dark U(1) gauge theory can avoid the cosmological constraints, leaving some open parameter space to explain the MiniBooNE anomaly. We study the phenomenology of this model in the entire parameter space, showing how the T2K near detector could place the strongest constraints.