Vaginal candidiasis is a common form of infection in women caused by Candida species. Due to several drawbacks of conventional treatments, the current research is attempted to formulate and optimize a miconazole nitrate-loaded in situ spray gel for vaginal candidiasis. The stimuli-responsive (pH and thermo-responsive) polymers selected for the in situ gel were chitosan and poloxamer 407, respectively, whereas hydroxypropyl methylcellulose (HPMC) was introduced in the formulation to further improve the mucoadhesive property. The dispersion of each polymer was carried out using the cold method, whereas the optimization of the formulation was achieved using Box-Behnken statistical design considering viscosity and gelation temperature as dependent variables. Present design achieved the optimized outcome with HPMC, poloxamer and chitosan at 0.52% (w/v), 18.68% (w/v) and 0.41% (w/v), respectively. Evaluation of drug-excipients compatibility was performed using differential scanning calorimetry, Fourier transform infrared spectroscopy, and thermogravimetric analysis where the results showed the absence of any chemical interaction between the polymers and drug component. The optimized formulation showed gelation temperature at 31°C allowing in situ phase transition in a vaginal environment; pH of 4.21 is suitable for use in the vaginal cavity, and appropriate viscosity (290 cP) at storage temperature (below 30°C) would allow spraying at ease, whereas strong mucoadhesive force (22.4±0.513 g) would prevent leaking of the formulation after application. The drug release profile showed sustained release up to 24 h with a cumulative drug release of 81.72%, which is significantly better than the marketed miconazole nitrate cream. In addition, an improved antifungal activity could be correlated to the sustained release of the drug from the formulation. Finally, the safety of the formulation was established while tested on HaCaT cell lines. Based on our findings, it could be concluded that the in situ hydrogel formulation using stimuli-responsive polymers could be a viable alternative to the conventional dosage form that can help to reduce the frequency of administration with ease of application to the site of infection, thus will provide better patient compliance.