Keep good company.
There are plenty of sayings illustrating the importance of keeping good company - “you’re known by the company you keep”, “birds of a feather flock together”, and such. Research indicates that there is some truth to these idioms; in fact, you are more or less the combined average of the five people you associate with the most.
So, if the people around you have a negative outlook on life, you will find it increasingly difficult to have a positive one. If the people around you are lazy and unmotivated, you will find yourself falling into the same patterns.
Surround yourself with good people; the type of people you would like to emulate, and you will succeed.