Check out this Ngram.
When using "the best way", that phrase is most often followed by an infinitive:
The best way to eat pizza is by starting at the point.
The best way to prepare a roast is to cook it slowly.
The best way to hit a baseball is to practice – a lot.
The best way to ruin a first date is by talking about yourself too much.
The best way to use "the best way" is to follow it with an infinitive.
However, this is not the only way to use the phrase; "the best way" can also be followed by of with a gerund:
The best way of increasing morale in the workplace is to care about the workers.
The best way of preventing a heart attack is to both exercise regularly and eat well.
A third pattern found in the Ngram results is to use "the best way" followed by for with a noun or pronoun:
The best way for teachers to evaluate their students is by using oral exams.
The best way for us to solve this problem is to work together.
So, any of these will work in your case:
The best way to live happily is to get rid of stress.
The best way of living happily is to get rid of stress.
The best way for you to live happily is to get rid of stress.
But there are other ways to say the same thing; for example, I can use "the best way is" (which is also listed on the Ngram):
When it comes to living happily, the best way is to get rid of stress.