People who come to Mexico for leisure or business visits and who are passport holders of one of the many countries which don’t require a visa to enter Mexico (such as the USA or Canada), can complete a Visitors permit, known as Forma Migratoria Multiple or FMM, at the port of entry, and stay in Mexico for up to 180 days.
The decision as to how many days are granted, however, remains at the discretion of the immigration official at the port of entry and the number of days granted (written) on the permit is the maximum time you are allowed to stay in Mexico: it will never exceed 180 days, but it may be less. You cannot have the number of days extended, and you cannot renew this permit. Visitor permits cannot be extended or renewed, so if your permit expires you'll have to leave the country.
It seems that recently FMM is going after "perpetual visitors" - people who have been using the flexibility of the Visitor permit to continually return to Mexico and remain long-term and therefore avoiding having to apply for residency. Now some immigration officials have been checking the arrival records of people coming to Mexico and questioning their intentions.
If you're just coming in for a short stay, this will not be a problem for you. But if you are staying longer make sure that the number of days written on the permit by the immigration official covers the full term of your stay. If you're intending to be in Mexico long-term (more than 180 days), or doing so on a regular basis, it's recommended you apply for residency in Mexico. If you are already in Mexico and have concerns or questions about an existing visitor permit, you should contact your local INM office for advice and guidance.