Pre-canon. Sherlock recorded ASMR or other types of sleeping aides videos and posted them online when he feels bored. In those videos he would read stuff like scientific reports and never showed his own face. John accidentally found his videos and they helped a lot with his sleeping problems after Afghanistan. Then one day, John decided to write an thank-you email/John bumped into Sherlock/John was introduced to Sherlock whose voice is exactly the same as the one that brought him to sleep every night...
Sleeping Aids Videos