Agarwood, derived from the Aquilaria genus, is widely utilized in perfumery, traditional medicine, and cultural practices throughout Asia. Agarwood is rich in terpenes, especially sesquiterpenes, which are considered to be the source of its rare and exquisite fragrance. This Review consolidates recent research on sesquiterpene biosynthesis in agarwood and the influence of fungi on these processes, alongside a discussion of the potential medicinal value of agarwood sesquiterpenes. This Review commences by elucidating the general biosynthesis of sesquiterpenes and identifying the main enzymes and transcription factors involved in the production of agarwood sesquiterpenes. This Review also summarizes the fungi associated with agarwood and highlights how commensal fungi stimulate agarwood and sesquiterpene production. We then scrutinize the pharmacological properties of sesquiterpenes, underscoring their anti-inflammatory and antimicrobial effects, which are closely linked to cellular signaling pathways, such as the NF-κB and MAPK pathways. Additionally, we review the potential therapeutic benefits of agarwood essential oil for its antidepressant properties, which are linked to the regulation of stress-related neurochemical and hormonal pathways. This Review also addresses the challenges of sustainable agarwood production, highlighting issues such as overharvesting and habitat loss while discussing the potential strategy of harnessing microbes in agarwood production to support the ecological preservation of wild resources. By advancing our knowledge of agarwood and sesquiterpene characteristics, we propose potential directions for the future application and sustainable development of agarwood research.