I agree with others I think it’s a hard one. Sexual attraction and love aren’t the same thing, you can be sexually attracted to someone you just met and have no feelings for, and you can love someone without being sexually attracted to them.
We all change with age, that’s life, nobody looks the same at 70 as they did at 25, but there are elements of it, like taking care of yourself, which are within our control to an extent.
Can I honestly say that I would still want to have sex with my husband if he gained a significant amount of weight? Probably not. I’d still love him, but would I still get that attraction and desire? No. And if he came to me and said we should use lube to get around my lack of desire I can’t say for sure that I wouldn’t have made a similar comment to the one your husband made back.
It sounds like what you both really need is an open and honest chat about what the issues are, rather than you insulting him by assuming he needs viagra and then him insulting you back by telling you to lose weight. It’s a tough and very emotive thing to talk about, it is always going to be upsetting to hear your partner doesn’t find you attractive, but it’s something you would both benefit from discussing and getting out in the open to see if between you there is a way forward, or indeed to find out if you both want to find that way forward.