Midazolam is a drug that is metabolized by cytochrome P450 (CYP450) enzymes, particularly CYP3A4 and CYP3A5. The present study aimed to determine the sex and age influence on association of CYP450 polymorphism with midazolam levels in critically ill children. Seventy-two DNA samples were genotyped by real-time PCR. Children ≤ five years of age who carry the rs776746 (T) allele in CYP3A5 gene were associated with lower plasma midazolam levels. The concentration median in patients was 0.0 ng/mL, while in patients with the normal (C) allele, it was 438.17 ng/mL (Q25 135.75–Q75 580.24), p = 0.005. The midazolam plasmatic concentration in female patients with the minor (T) allele was 0.0 ng/mL (Q250.00–Q75204.3), while in patients with the normal (C) allele median it was 459.0 ng/mL (Q25296.9–Q75789.7), p = 0.002. Analysis of the dominant model for the rs2740574 variant in CYP3A4 revealed a median of 0.38 L/kg (Q250.02–Q751.5) for the volume of distribution parameter in female patients with the normal T allele, while female patients with the minor C allele showed a median of 18.1 L/kg (Q257.5–Q7528.7) p = 0.02. Our results suggest an altered midazolam metabolism due to the presence the allelic rs2740574 variants of CYP3A4 and rs776746 of CYP3A5, and also the strong influence of age and sex.