How far from the times of Mohammad was it?
It's attested to in the hadith. Dating the origins of hadith is a famously difficult problem in Islamic studies. Obviously the religious position is that sound hadith, of which Buraq (the winged creature, I don't think it's actually a horse per se. edit: Tabari records a hadith that it was simply "a horse" but as I said, most such references are to a winged not-a-horse creature.) would certainly be one, date back to the recollections of the companions of the prophet and record true incidences. As a maximal end date, Sahih Bukhari, one of the collections that records this hadith, was compiled in the 9th century. edit: I just double checked this in the Encyclopedia of Islam. That records a date-able reference to Buraq in the works of a poet, "Adjdjadj", who died in 715. This is caveated with the note that this is the earliest such reference if it "is genuine." I'm not at all familiar with this particular poet or whether his attested works are regarded as genuine.
The night flight itself is Quranic. The dating of the Quran is likewise a matter of some dispute but far less than the hadith. The general scholarly consensus is that the Quran, with some variations, is actually the product of Muhammad and so dates to the 7th century. Dating individual suras or portions of individual suras is more difficult. The most relevant Sura in question is Sura 17, Surat al-Isra, is "Meccan" meaning it was composed before Muhammad's hijra to Medina in 622. Noldeke classifies it as "middle Meccan."
edit: as per above, for further reference please see the entry in the Encylopaedia of Islam under "Burak".