gonna go out on a limb here and say your friend is lying to you. i had a friend in high school who claimed a demon was inside her and she used it to curse people. while there could be something helping him with answers, it's most likely his intuition, or a spirit guide, perhaps even an energy form. [something he created himself] i've heard of people claiming to have deities, demons, spirits, or djinn inside them, but i've never met anyone who was telling the truth.
if your friend is telling the truth, your friend probably gave the djinn permission to dwell within him in exchange for knowledge. people make deals with higher beings [demons/spirits/deities] like this. typically there's an exchange of some sort, normally the human gains power, while the being feeds off the humans energy. while you shouldn't do this as certain beings are tricky and can drain you, deals like this do happen.
i would just ignore his claims until solid proof is provided.