You've obviously realized that hair plays a pretty important role in Samson's story. But what you may not know is that the religious significance of hair has a long symbolic history in Judaism. In the Book of Leviticus, it's a sign of devotion to God for men to not cut a certain part of their hair (called a peyos, roughly like a sideburn). So for Samson to reveal that his strength is contained in keeping his hair long is not only to compromise his strategic advantage over the Philistines, but also to break a long-standing pact with God.
Okay, that's the good. The bad? Hair has also long been symbol of vanity and obsession with one's appearance. And sure enough, Samson does seem to have been, or sometimes still is, rather vain about his own strength. But the fragility of his hair should have reminded Samson to be more humble and cautious about his gift of strength.
Despite all this seriousness surrounding Samson's hair, Milton is still down to make a little pun: "At times when men seek most repose and rest,/ I yielded, and unlock'd her [to Dalila] all my heart" (406-7). Get it? Unlocking his heart resulted in being literally un-locked, lacking his locks of hair? Yeah, we think Milton realizes Samson's hair is just a little funny.