Someone asked my instructor the same thing once. If you give the guy a huge knee to the midsection he is gonna be hurt. Punches are not as effective from the clinched compared to knees. Sometimes you have to take a little damage to inflict more.
You can't really defend during a clinch. You could try and move your head round and stop the head shots but it really is very hard. However to stop the punches being brutal keep close to the opponent. This is important as it stops alot of force and swing enabled during their punches so the minimum damage is dealt to you.
Typically you're not too worried about punches in the clinch. Elbows, Knees, and even takedowns are often bigger threats. If you're opponent tries punching you, they are likely opening up the clinch and you can seperate.
If you have the person in a good clinch the persons punches will be weak because they are unable to use there hips for power.
Every clinch tutorial on youtube and from professional fighters such as Anderson Silva seem to ignore punches coming from your opponent to your head when you clinch them. I don't have a teacher and i have tried searching online but found no answer.