This is also a lesson in how one is to perfect his relationship with other people with whom he is close, but who are outside of his home. Next, we are warned against attaching ourselves to a wicked person. Even if you didn't initiate a relationship with a bad neighbor but he approached you, you are told to actively distance yourself from evil neighbors who want to get close to you. But to acquire friends requires proactivity on your part, and it is sufficient that you do not seek out relationships with evil people in order to be distanced from wicked friends.
Friends require active cultivation.
It should not be necessary to actively distance oneself from evil friends - refraining from an attachment is enough. The final lesson of this Mishna is that a person should realize how susceptible he is to negative influences. Just as responsible people don't place themselves in physical danger, due to the possible damaging consequences, we should take equal care to avoid spiritual danger, whose likelihood is greater and whose consequences are more serious than physical danger. Therefore a person has to avoid any attachment and constantly distance himself from bad influences. Just as exposure to physical danger can lead to the destruction of the human being, so, too, can exposure to spiritual danger.