In this verse the prayer is intensifying. Behind words and deeds goes the mind and the heart. David prays that God may keep him from evil thoughts and desires (see Proverbs 4:23). This request reminds us of the sixth request in the prayer that the Lord taught us to pray: lead us not into temptation, but deliver us from evil
(Matthew 6:13). This prayer teaches us that it is important that you honestly open up your heart and mind before God and ask him to keep them pure.
David has also avoided close ties with the evildoers. If you would dine with them or would seek their company, you can easily be seduced to take part in their evil deeds. You will get used to their riches and luxury, the rotten fruits of their evil and corruption. David’s prayer is that God will guard him from all that evil influence.
4 Do not let my heart incline to any evil, to busy myself with wicked deeds in company with men who work iniquity, and let me not eat of their delicacies!