When Henry VI Part II was written and where Shakespeare found his inspiration for the play.
Henry VI Part II was likely written around 1591-92, almost certainly before Henry VI Part III.
The two plays were thought to have been played as partner productions, with Henry VI Part I possibly written later as a prequel following their success.
The first publication of the play was a shorter Quarto version in 1594, entitled The First part of the Contention betwixt the two famous Houses of Yorke and Lancaster, with the death of the good Duke Humphrey: And the banishment and death of the Duke of Suffolke, and the Tragicall end of the proud Cardinall of Winchester, with the notable Rebellion of Jacke Cade: And the Duke of Yorkes first claime vnto the Crowne.
The description of the play as such allows it to be identified as Henry VI Part II, and reinforces the notion that Part I, as we know it, was written later.
Sources
As with Henry VI Part I, primary sources seem to include Edward Hall's The Union of the Two Noble and Illustre Famelies of Lancastre and Yorke (1548) and Holinshed's Chronicles.