Associate with people who are likely to improve you.
Seneca, a Roman Philosopher
Learning this has been such a "light bulb moment" for me. I learned that when I hung around negative complainers, I became a negative complainer. Then when I hung around with people who rather than focused on what was going wrong in their life and instead focused on the good, my attitude began to changed. When I hang around people who eat right and are active, I tend to be more active and eat better foods. When I hang around people who are HAPPY, I am happier too.
Take a look at the people who you spend the majority of your time with. What are their attitudes? How do they feel about themselves and express themselves to others?
Maybe you can't cut those "Negative Nellies" out of your life, but you can change how you communicate with them. Don't feed into their negativism. When they are starting their negative speech, twist it into a positive. When they are putting others down, find something good to say about that person. Eventually, the "Negative Nelly" will learn you aren't going to play their game and will find that they can't have those kind of conversations with you. I have done this with a few people in my life and even though they are still frequently negative, their negativeness doesn't spread into my attitude as well.