This study aimed to investigate the effect of knowledge management (KM) and dynamic capabilities (DCs) on the improvement of the performance of knowledge firms through the mediating role of sustainable competitive advantage (SCA). The study was applied in terms of purpose and descriptive-correlational in terms of nature. A number of knowledge firms in Tehran province were selected as the statistical sample. The optimal sample size was calculated to be 288 people using G-Power software version 3.1. Using a simple random sampling method and through an online survey (Response Rate of 64%), 186 questionnaires were collected. Data analysis was carried out using Smart PLS 3. The findings revealed that KM and DCs enhanced the performance of knowledge firms through strengthening SCA. The current study extends the literature on management by bridging the research gap. It is suggested that creating and applying KM and DCs simultaneously, through SCA, can provide the essential setting for the significant improvement of knowledge firms’ performance and assist managers and policymakers understand how to improve the firm performance (FP) in dynamic environments. This paper is built on the assumptions of the resource-based view and the perspective of the firms’ dynamic capabilities. The findings of the study help firm managers and practitioners to create and maintain a SCA and improve performance through a KM approach and DCs. In addition to theoretical contributions, this study provides a variety of practical advice for managers and policymakers to succeed in applying KM and DCs to achieve better performance.