Hi welcome to Justanswer
In order to stay longer than 180 days in mexico, you must apply por temp visa, and you must meet any of the following requirements:
1.- Economic solvency
2.- Family bond (parents, minor children, spouses, concubines, under-age stepchildren) with Mexican or foreigner who has the status of Temporary Resident or holder of a Temporary Residency visa.
3.- it has real estate in the national territory
4.- it has investments in national territory.
If you meet some of the above requirements, you can go to the immigration office in Mexico and start your process to obtain the visa.