He blinked and he looked down, afraid to tell her the actual reason. Yet she ws a machine, and as such she most likely knew what to think of when he said this. He rubbed his eyes and sat up. "I-I'm lonely... it's comforting to have another pony around you, especially to cuddle -hold- them while you sleep. It feels safe to me."
She tilts her head. "That is what companions are meant to do, correct? Ponies are social creatures that require interaction with other ponies. I resemble a pony, and have the capability to interact with you, and therefore satisfy this requirement." She swished her tail, apparently pleased that she was doing her job correctly.
He gently looked at her and slowly pulled her into his hooves, rubbing their heads together, "You're being an amazing companion." He smiled widely before petting down her back a little.