The sharing economy is a fast-growing business model, and the sharing resources have crept from physical assets (e.g., vehicles and houses) to intangible assets (e.g., skills and knowledge). Online knowledge-sharing platforms allow sharers to offer knowledge products in various forms and can generate revenue through charging users subscription and/or transaction fees. How to charge bilateral users is an essential and complex decision-making problem that puzzles knowledge-sharing platforms. This study proposes a dynamic optimal pricing model that involves multiple development stages based on the optimal control theory. In addition, the inherent features of knowledge products and sharers’ social capitals are considered. The applicability and utility of the proposed model is verified through numerical experiments on an empirical dataset from the China’s largest knowledge-sharing platform named Zhihu. The results reveal that the platform can adjust its pricing strategies to achieve different optimization goals and this is conducive to its sustainable development.