As per the context is concerned, I studied somewhere that Ramayana was written later than Mahabharata, as it shows the diffusion of people in much deeper parts of India and there by towards Sri Lanka. Is is true? How does the events of Aryan invasion deeper to the continent might have influenced these epics?
Not a historian, and got nothing about when the texts were "written". Only wanted to tell you that Ramayana took place in the Treta Yug and Mahabharat during Dwapar, which means chronologically Ramayan happened much before Mahabharat.
About the Yugs, please refer http://en.wikipedia.org/wiki/Yuga
Also, the links below may help you. http://www.hindunet.org/hindu_history/ancient/ramayan/rama_vartak.html http://www.hindunet.org/hindu_history/ancient/mahabharat/mahab_vartak.html
Regarding your first question, many scholars agree that the date range for the Mahabharata begins and ends slightly earlier than that of the Ramayana. The Mahabharata dates to between 400 BCE and 400 CE^[1], while the Ramayana is somewhere in the 200 BCE to 200 CE range.^[2]. Nobody's been able to pin down a concrete date on either work--the two scholars I'm citing, Barbara Stoler Miller and Carl Olson, are pretty big names in the field, and both state that there isn't a precise composition date for either work.
Unfortunately, since the date ranges are a) extremely wide and b) overlapping, it's difficult to say what historical events affected composition of the works since nobody really knows what historical events were happening. A lot of this uncertainty is due to a basic lack of evidence about the classical period of Indian history.
Short answer: the Mahabharata was probably composed before the Ramayana, but it's tough to tell since the works were transmitted orally long before they were written down.