I really reccomend a minimum of 5 gallons for bettas to be happy. So I would get that ASAP. But also do water changes once a week at least and only scrub everything down like once a month. Read about cycling that others put the link to because ammonia poisoning is serious! You are also feeding too much pellets. I reccomend only feeding 2-3 pellets EVeryday 1-2 times a day. I also give my betta a “fast” day without feeding him so he can digest that day. Feed him a little peice of pea and he will be better soon! But if you don’t get your tank cycled (and get at least a 5gal) your betta will have more issues in the future.