Highly selective and reconfigurable microwave filters are of great importance in radio-frequency signal processing. Microwave photonic (MWP) filters are of particular interest, as they offer flexible reconfiguration and an order of magnitude higher frequency tuning range than electronic filters. However, all MWP filters to date have been limited by trade-offs between key parameters such as tuning range, resolution, and suppression. This problem is exacerbated in the case of integrated MWP filters, blocking the path to compact, high-performance filters. Here we show the first chip-based MWP bandstop filter with ultrahigh suppression, high resolution in the megahertz range, and 0–30 GHz frequency tuning. This record performance was achieved using an ultralow Brillouin gain from a compact photonic chip and a novel approach of optical resonance-assisted RF signal cancellation. The results point to new ways of creating energy-efficient and reconfigurable integrated MWP signal processors for wireless communications and defence applications.