Active learning methods, such as team- and problem-based learning, are known to improve students’ learning attitudes and teamwork skills in undergraduate education. This study conducted an experiment that incorporated an escape room (ER) in classes with the aim of improving students’ motivation to learn and knowledge acquisition through collaborative learning. An ER was designed and administered to third-year undergraduate pharmacy students. Students were randomly assigned to a control group (regular lecture focused on knowledge transfer) or an ER group. Both groups completed pre- and post-tests. Learning outcomes and educational usefulness were evaluated using statistical analyses (t-test and chi-squared test) and text mining. The ER group had significantly higher average post-test scores compared with the control group, particularly in terms of new knowledge acquisition. The results of the questionnaire survey, which included free-form responses, indicated improvements in enjoyment, concentration, and motivation to learn. The ER provided opportunities for collaborative, active learning and demonstrated significant benefits in knowledge acquisition and educational usefulness, including increased motivation. These results could be attributed partly to the fact that ER provides a learning experience combining challenge and a sense of accomplishment, leading to a flow-like psychological state. Therefore, ER demonstrates its potential as an effective method of knowledge education in pharmacy education. Future research can clarify the effectiveness of ER by further examining the conditions that maximize the learning benefits of ER, such as the learning effects of review content and its application to other pharmacy-related subjects.