Scoring functions for protein−ligand interactions play a critical role in structure-based drug design. Owing to the good balance between general applicability and computational efficiency, knowledge-based scoring functions have obtained significant advancements and achieved many successes. Nevertheless, knowledge-based scoring functions face a challenge in utilizing the experimental affinity data and thus may not perform well in binding affinity prediction. Addressing the challenge, we have proposed an improved version of the iterative knowledge-based scoring function ITScore by considering binding affinity information, which is referred to as ITScoreAff, based on a large training set of 6216 protein−ligand complexes with both structures and affinity data. ITScoreAff was extensively evaluated and compared with ITScore, 33 traditional, and 6 machine learning scoring functions in terms of docking power, ranking power, and screening power on the independent CASF-2016 benchmark. It was shown that ITScoreAff obtained an overall better performance than the other 40 scoring functions and gave an average success rate of 85.3% in docking power, a correlation coefficient of 0.723 in scoring power, and an average rank correlation coefficient of 0.668 in ranking power. In addition, ITScoreAff also achieved the overall best screening power when the top 10% of the ranked database were considered. These results demonstrated the robustness of ITScoreAff and its improvement over existing scoring functions.