A list of places to stay in madrid and near the university…
The erasmo residence hall has also rooms for days and weeks [link].
Tres cantos is 8 km away from the university and conected by cercanias every 10 minutes and the ride takes less than 10 minutes. There are two hotels near the train station:
Alcobendas is 5 Km away from the university. If you have car is an option to look in Alcobendas and or San Sebastian de los Reyes.
The most convenient locations are “Plaza Castilla” or “Chamartín station”. The areas are not fancy, but very safe and with a very good access to public transportation, either bus, metro or cercanias. From “Plaza Castilla” there is a direct bus to the UAM campus, and from “Chamartín station” the cercanias train connects direct to the university in 10 minutes.
There are a couple of good hotels at “Plaza Castilla”:
Silken Puerta de Castilla – [link].
Abba Castilla Plaza – [link].
And others good hotels in “Chamartín” is:
Hotel HUSA Chamartín http://www.hotelhusachamartin.com/
However, the public transportation network in Madrid is very good (http://www.ctm-madrid.es/). Thus, any centric hotel is fine regarding commute time to UAM campus, which should be less than one hour from any point and less than 20 min from Plaza Castilla. The cercanias train form “Sol” (the city center) to the university takes 20 minutes.