Hello there! I believe your answer would be:
B: It is a gerund functioning as a verb.
Explanation: It couldn't be infinitive since the phase would have "to be" in it, which it clearly does not. It is not a gerund functioning as a noun since the sentence would have some form of "sleeping is nice". Therefore, if we use Sherlock Holmes's logic (It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. -Sherlock Holmes) The only answer that could be applicable is B.
I hope that you find my answer to be helpful, and I would like to hear if this was correct. Also: Brainliest would be greatly appreciated.