The activity of voltage-gated ion channels can be controlled by the binding of photoswitches inside their internal cavity and subsequent light irradiation. We investigated the binding of azobenzene and p-diaminoazobenzene to the human Nav1.4 channel in the inactivated state by means of Gaussian accelerated molecular dynamics simulations and free-energy computations. Three stable binding pockets were identified for each of the two photoswitches. In all the cases, the binding is controlled by the balance between the favorable hydrophobic interactions of the ligands with the nonpolar residues of the protein and the unfavorable polar solvation energy. In addition, electrostatic interactions between the ligand and the polar aminoacids are also relevant for p-diaminoazobenzene due to the presence of the amino groups on the benzene moieties. These groups participate in hydrogen bonding in the most favorable binding pocket and in long-range electrostatic interactions in the other pockets. The thermodinamically preferred binding sites found for both photoswitches are close to the selectivity filter of the channel. Therefore, it is very likely that the binding of these ligands will induce alterations in the ion conduction through the channel.