Humans are social creatures by nature; they're always in need of friends and companions. Most of our lives depend on interaction with others. Strong individuals are the core of a strong community, something that Muslims should always strive for.
We all know that Allah (SWT) the Most High has brought us to life in order to test us. Thus we are here for a relatively short period of time and that we shall meet Allah (SWT) one Day, so we need to use our present life for what is best for us in the hereafter. Once we know our purpose and our goal in life, we should seek ways to achieve them so as to benefit our own selves.
In an authentic Hadith, Prophet Mohammad (pbuh) said: "Man is influenced by the faith of his friends. Therefore, be careful of whom you associate with."
Prophet Mohammad (pbuh) who has the most noble character and dealings with fellow humans gave us a very clear and simple message and advice in regard to friendship.
How should we choose our friends? We should choose the friend that believes and abide by our religion (Islam) and gives great respect to what Allah (SWT) and Prophet Mohammad (pbuh) has ordered us. And we should stay away from that who is not well mannered and gives no attention to what Islam is about or what pleases or displeases Allah (SWT), for he will surely affect us negatively. There is no good in the companion drowns us in sins and displeasing Allah (SWT).
In another Hadith, Prophet Mohammad (pbuh) said: "The example of a good companion and a bad companion is like that of the seller of musk, and the one who blows the blacksmith's bellows. So as for the seller of musk then either he will grant you some, or you buy some from him, or at least you enjoy a pleasant smell from him. As for the one who blows the blacksmith's bellows then either he will burn your clothes or you will get an offensive smell from him."
When choosing our friends we should ask ourselves first: Are they going to help us achieve the purpose for which we were brought to life? Or will they take us away from it? Will they desire for us Allah (SWT)'s pleasure or is that completely irrelevant to them and not their concern at all? Are they leading us to Paradise or to the Hell?