Shakespeare drew upon a number of sources for the play. In both theme and structure, Romeo and Juliet has certain similarities with the tale of Pyramus and Thisbe in Ovid's Metamorphoses. In this ancient story, the two lovers' parents loathe each other, and Pyramus, like Romeo, wrongly believes that his lover is dead, when in actual fact she has taken a powerful sleeping potion.
The names of the warring families—the Montagues and the Capulets—appear to come from Canto VI of Dante's Purgatorio in The Divine Comedy. But it was arguably the Italian author Luigi Da Porto who provided Shakespeare with the inspiration for his play. He adapted the old story of Mariotto and Gianozza by Masuccio Salernitano into the tragic tale of Guilietta e Romeo. (Which, of course, is the Italian for Juliet and Romeo).
It was Da Porto who gave the tale its recognizable structure as well as the names of the tragic lovers, the names of the warring families, and the setting of the story, Verona. As in Shakespeare's version of the story, Romeo poisons himself and Juliet stabs herself to death with a dagger.
Stage adaptations of Italian stories were very popular in Shakespeare's day, and as an astute businessman as well as a great playwright, Shakespeare undoubtedly spotted a great opportunity to cater for the taste of the theater-going public he knew so well.