The aim of this study was the development and optimization of chitosan and hydroxypropyl methylcellulose (HPMC) in situ gelling systems, loaded with bupivacaine hydrochloride for topical ocular administration. This study is based on the properties of two polymers: chitosan, which has mucoadhesive action and is a pH-sensitive polymer, but also the cellulose derivative hydroxypropyl methylcellulose, a thermosensitive polymer which has mucoadhesive properties and increases the viscosity of systems. The analysis and optimization of in situ gelling systems were performed based on an experimental design and response surface methodology. The following formulation parameters were considered: X1 = chitosan concentration (0.5%, 1%), X2 = HPMC E 5 LV concentration (2%, 5%) and X3 = Chitosan/HPMC E 5 LV ratio (1/1, 2/1). In addition, the parameters to be optimized were represented by the contact angle (CA (°)), viscosity and cumulative percentage of bupivacaine hydrochloride released in vitro. The results indicate that the designed in situ gelling systems are suitable for bupivacaine prolonged ophthalmic release and overcome the principal disadvantages of the liquid’s ocular formulations. An immediate therapeutic effect corresponding to ocular anesthetic installation was assured in the first stage: burst bupivacaine release. In the second phase, the gradual drug release was assured for over 6 h. This drug release profile, together with the corresponding rheological profile and a collection of superficial properties for good ocular adhesion balanced with an adequate hydrophilic character, assured the desired quality of the attributes for the proposed systems. The system, based on chitosan 1%, HPMC E 5 LV 5% and a 1/1 polymer ratio, could be a solution for the proposed formulation of in situ gelling colloidal systems, since the viscosity of the system was within the range of the optimal viscosity of the eye, and the amount of bupivacaine hydrochloride released after 6 h was the highest at 69.55%.