Metal organic frameworks (MOFs) with certain pore structures are beneficial for encapsulating small molecules and realizing functional applications. In this work, ionic liquids (ILs) with similar chemical structures and different molecular sizes were in situ encapsulated in UiO-66-NH2 nanopores in the synthesis process. IL with a molecular size comparable to UiO-66-NH2 nanopores could be effectively encapsulated. The prepared ILs@MOF-based sensor shows good sensing performance in the relative humidity (RH) range (5–95%) with a small humidity hysteresis of 1.0% RH and good stability, and found the response value is closely related to the IL encapsulated amount. The multifunctional applications of the optimized sensor in human breath, skin humidity, and low humidity detection were explored. This work proves the importance of size selection in preparing ILs@MOF nanomaterials with low leakage risk for specific functionalization.