First of all, stop smoking. Drink less coffee. Brush your teeth more often and for a longer period of time. In addition, pay attention (especially people who don't smoke or drink coffee) to the food you eat. You may be sensitive to a certain food stains your teeth.
It should be emphasized that in the case of neglect (increased smoking, etc.), whitening doesn't help either.