Was this gaslighting?

So I was friends with this guy for a little over two years, and just ended the friendship in March of this year. Throughout our friendship, he would make offhand comments about me looking like a man (for context, I am a cis woman and a lesbian, he is a bisexual trans man).

He would say things along the lines of: “Oh, I would date you if you were a boy!” and “You look a lot like [insert male celebrity here]!” I thought his comments were funny at first, and would also get in on the joke occasionally. They definitely weirded me out, but I wrote it off as just his sense of humor.

The comments only started to really make me feel BAD around the start of this year. I don’t remember if I ever confronted him about what he was saying. I think I may have once, because I remember him apologizing and saying that he just meant I was cute/attractive. That didn’t really stop him from doing it.

Some days he would be the only person I spoke to, and I was dependent on him for a lot of things validation-wise.

I really don’t remember a lot of our last conversation. I know that I was really insecure based on what he said to me, and was starting to begin to question myself. It felt like I couldn’t do things I normally used to do because of what he was saying to me. I asked him, “Do you really think I’m a man?” and told him I was comfortable being a woman.

Long story short, he did. He told me that he thought I was “probably a man in denial” since the day I met him. He went on to invalidate a lot of my feelings (telling me that I was in denial, telling me I only wore certain things because I was just a “feminine man” instead of a woman, etc.). Every piece of evidence that I was a woman was shot down. He said that he was trying to help me.

This led to months of relentless anxiety. It was the worst I had ever experienced to date. I couldn’t remember things correctly, I was obsessing over my appearance and presentation like never before. I had never had doubts like this before, EVER. He would continue to egg me on and question everything I did until I ended the friendship.

Anxiety would make it seem like I couldn’t wear certain outfits, watch certain things, etc., or else I would somehow “realize” that I actually was a man (nonsensical, I know). My friend would also tell me that if I liked certain things, it was probably because I was a man. He would tell me that things I had done before and events from my childhood meant that I was a man. I believed him. It got so bad that I couldn’t eat without getting sick. It became hard for me to look at my body. I felt guilty, because before this I was incredibly confident in myself and my identity.

I’ve spoken to many others about this and they’ve all said he was being manipulative, but I can’t get myself to believe that. I’m getting better, but it's hard. What was this? Was I being manipulated, or am I lying to myself? It feels like I’m going crazy.