Using a vertical differentiation model of endogenous growth with stochastic R&D activity, we characterise the optimal patent lifetime a government would set in order to maximise economic growth. We show that a finite patent lifetime does exist and is unique provided that the expected rate of return from R&D is sufficiently large. Additionally, we analyse the impact of the level of competition in the R&D sector, the interest rate, the monopoly profit and the productivity parameter of research technology on this optimal patent lifetime.