Strive to choose righteous friends
Strive to choose righteous friends who are preoccupied with seeking knowledge and are of a good nature, who can help you in achieving your aim, add to the benefits you have already gained, encourage you to seek more knowledge and stop you from feeling bored and tired; friends who are religiously-committed, trustworthy and of good character, who are sincere towards Allaah and who are not merely messing about.
(See Tadhkirat al-Saami’ by Ibn Jamaa’aah).
Beware of the bad companion, for he may influence you and people are like birds, they will resemble one another [i.e., “birds of a feather flock together”].
So beware of mixing with people like that, for that is a sickness, and prevention is better than cure.