Will long distance work?

I’ve been with my boyfriend for 2 and a half years and I want to stay with him after I leave, but I don’t want to waste his time. I’m currently enlisted for 4 years but I’m thinking about doing another 2-6 when I finish. So can anyone who’s tried/ is in a long distance military relationship give me some advice!?