Young individual like you having Night emissions from 17 years of age in 2-3 times a week is common as your sexual urges are not channelised properly.
Since young man at that age is unlikely to settle down with marriage...
usually resorts to masturbation or occasionally sex with available sex partner. If both are deprived or stopped due to fear/guilt or misconceptions, night emissions are bound to happen.
As you correctly read, the regularly produced sperm in testes (if not discharged in conventional sex or masturbation) leaks out in deeper sleep (REM sleep phase where dreams are common 😗) usually in the early hours of morning which also coincides with high
Testosterone levels and full urinary bladder.
Such discharges cause staining of undergarments/ bed linen etc. It may be even socially embrassment too.
Moreover, most men leave the penis unwashed and continue to use same underwear which may attract bacterial/ fungal infections.
As far as pain while retrieving foreskin may be due to tight Prepuce with small opening called as PHYMOSIS. Certainly it hurts and underneath head (glans) penis will be sensitive. Get it corrected.
Next Steps
please report to sexologist for foreskin evaluation and advice regarding the need of CIRCUMCISION surgery.
Desensitization of sensitive head of penis can be done by a procedure with anaesthetic gels after surgery making you more comfortable in conventional intercourse.