David lists a few ways to keep a blameless (not perfect, there's a difference) walk before the LORD. The overarching theme of all of them is to completely avoid any sort of sin temptation whatsoever. In this way, David is presented with fewer "opportunities" to fail. In this way, David keeps his house in order, never really knowing when God could show up on his doorstep, so to speak.
He removes vile things from his site, eliminates the company of evildoers and those who could influence him to turn to things ungodly. That specifically includes gossip and slander...liars. David was so mindful of these types of people that he devoted nearly an entire Psalm as a reminder to avoid them. He is the highly susceptible to temptation, and he realized that. This Psalm serves him well, I imagine.