In this paper, a microfluidic sensor based on slow-wave substrate integrated waveguide (SW-SIW) is proposed to measure the complex permittivity of liquids and it achieves an ultrahigh quality factor of 51156, which is much higher than previous reported designs. The proposed sensor consists of three-layer dielectric substrates and an active circuit. The traditional SIW has the fundamental mode of TE101, whose electric field is concentrated inside the SIW structure. The SW-SIW, which is evolved from traditional SIW structure, has the characteristic of relatively small electrical size due to large equivalent capacitance and the capability to confine the electrical field density further. The internal rows of blind via holes are connecting the top layer of second substrate to the bottom layer of third substrate. In order to further reduce the electrical size, an air cavity is formed in second substrate around blind via holes as it can increase the equivalent capacitance of SW-SIW resonator. The air cavity has an important impact on the resonant frequency of the sensor, and the electrical size could be reduced by enlarging the air cavity. In this paper, an appropriate air cavity is adopted with comprehensive consideration of detection sensitivity and electrical size. The polydimethylsiloxane (PDMS) microfluidic substrate is embedded in first substrate. When the resonator is excited, the electric field is confined above the surface of blind vias. The electric field varies with the volume fraction of aqueous solution injected into the microfluidic channel, and the resonant frequency and quality factor alter correspondingly. The variations in the resonant frequency and quality factor are applied to retrieve the complex permittivity of liquid samples. The proposed sensor is fabricated and tested, it has a dimension of 0.678λ0 × 0.432λ0 (λ0 is the wavelength in free space at 3.7 GHz), and the peak sensitivity and unloaded quality factor are about 2.5 % and 51156, which are improved by 67 % and 5015 % than traditional SIW sensor, respectively. In particular, the sensitivity of measuring loss tangent of liquid sample is improved by several times to hundreds of times with the loss tangent range from 0.1 to 0.9 than other reported sensors. The measured data has a good agreement with the reference complex permittivity.