Aim To develop pluronic F127 (PF127) based formulations of penciclovir (PCV) aimed at enhancing its ocular bioavailability. Methods Thermosensitive in situ gels of penciclovir were prepared through combination of HPMC K4M or carbopol 934P and pluronic F127. Optimized formulations were examined through measuring gelation temperature, rheology speciality, drug release behavior, pharmacokinetics and ocular irritation. Results The gelation temperature was reduced by adding HPMC K4M or carbopol 934P, and the viscosity was enhanced slightly. Either HPMC K4M or carbopol 934P delayed the release of PCV from in situ gel. PCV was released by non-Fickian diffusion. The study of ocular irritation for different PCV formulations did not show any irritation or damage for the cornea. PCV bioavailability from combination of carbopol 934P and pluronic F127 gels was higher than that obtained from any other gels. Conclusion Pluronic F127 formulations of PCV can be used as liquid for administration by instilling into the eye. Facilitated by the appropriate eye temperature, the formulations were transformed to gel phase. On the basis of in vitro and in vivo results, PCV formulations containing HPMC K4M or carbopol 934P and low concentration of pluronic F127 (12%) showed potential for use as a drug delivery system with improved ocular bioavailability.