Your boss can basically do that, yeah! Unfortunately, legally it's not as simple as "I've been doing this for two years, so it's my right now." The work-from-home arrangement was a voluntary allowance from your employer, not a contractual promise for eternity - if it's not explicitly laid out in your employment contract or a works agreement. But that doesn't mean you're completely helpless!
What you should do now: Check your employment contract and ask whether there's a works agreement about remote work. If there is, things could be different. Otherwise, you can talk to your boss or HR - not in a combative way, but matter-of-factly. Explain your situation (long commute, living situation has changed) and ask if you can find a solution together. A lot of bosses are more open when you ask nicely instead of just accepting a no. Maybe you'll agree on two days instead of three, or more flexible days.
If nothing works out and you'd have to travel a really long distance, your union or works council could help you - but without a contractual basis, unfortunately your options are pretty limited. Sorry, but that's just the legal reality!