How happy you are may depend on how happy your friends’ friends’ friends are, even if you don’t know them at all.

And a cheery next-door neighbor has more effect on your happiness than your spouse’s mood.

So says a new study that followed a large group of people for 20 years  happiness is more contagious than previously thought.

“Your happiness depends not just on your choices and actions, but also on the choices and actions of people you don’t even know who are one, two and three degrees removed from you,” said Dr. Nicholas A. Christakis, a physician and social scientist at Harvard Medical School and an author of the study, to be published Friday in BMJ, a British journal. “There’s kind of an emotional quiet riot that occurs and takes on a life of its own, that people themselves may be unaware of. Emotions have a collective existence  they are not just an individual phenomenon.”

In fact, said his co-author, James H. Fowler, an associate professor of political science at University of California, San Diego, their research found that “if your friend’s friend’s friend becomes happy, that has a bigger impact on you being happy than putting an extra $5,000 in your pocket.”