In one way, we can never actually know what inspired William Shakespeare to write Romeo and Juliet. He did not leave behind an autobiographical statement describing the moment in his life when he decided to compose the play. Although we cannot know the inner workings of Shakespeare's mind, we do know of several earlier works on the narrative of the two young lovers that provided source material for Shakespeare's play.
First, stories of young lovers prevented from marrying by hostile parents appear both in the classical and medieval traditions with which Shakespeare was familiar. The key plot elements of the tale originate in Masuccio Salernitano's fifteenth-century story "the Tale of Mariotto and Ganozza" which including a friar, secret wedding, and feigned suicide using a powder supplied by the friar.
The story was elaborated to include the two warring families and many of the other details found in Shakespeare's play in Luigi Da Porto's Historia Novellamente Ritrovata di Due Nobili Amanti (1530) and Matteo Bandello's Giulietta e Romeo (1554). The best known English version of the narrative, and the one which probably most directly influenced Shakespeare, Arthur Brooke's 1562 poem, The Tragicall Historye of Romeus and Iuliet.
I think Romeo and Juliet was inspired by another story- Pyramus and Thisbe. It was something to do with two lovers separated by their families and would meet up by the wall that separated them. They arranged to meet up but there was a wild animal I think so the girl ran away when she was meeting for her lover. The animal had her veil and the boy thought she was attacked and had died. He kills himself and the girl sees him and does the same with his sword. :)