Why did this guy admit he is lonely?

He is a guy friend and he told me this which made me feel sad and pity for him. For context, i visited him again in his city and we had a great time, a blast where we keep on laughing.

Whenever we see each other, he never fails to tell me he loves me, he always makes me feel important and buys me food.

In return, i also gravitate to him and message him when im in his city. We both are not that close to some of our siblings so we are acting like we are siblings but when he said there are times when he was lonely and contemplated suicide, my heart felt i had to stay in his city.

He has been convincing me to stay in his city but also said he gives up in convincing me but at the same time mentioned this on the last part before we parted ways. My question is why did he say this and admit to me?

Why did this guy admit he is lonely?
Post Opinion