Anyone who has earned income that is subject to AHV contributions can pay into the tied pension plan (pillar 3a) and deduct the payments from their taxable income. Payments can be made from the year you turn 18 until you reach the regular AHV retirement age.
Anyone who can prove that he or she is in gainful employment beyond the normal retirement age can continue to pay in pillar 3a for a maximum of five years beyond the normal retirement age and continue to pay in during this period.
Information on special cases (unemployment, cross-border commuters, early retirement) can be found in the following article: Who is entitled to pay into the 3rd pillar?