I feel like I'm struggling with this problem to. Somewhat luckily my attention span was never that big so I haven't lost a lot.
I think most of the things we do in day to day live consist of habits combined with choices we make. I think our attention span is mostly a habit.
The things I do in day to day live ingrain some habits. I like to read a lot on the internet, learn about things. However a lot of the content on the internet currently focuses on short attention spans, things like reddit (clicking on a few pictures, opening an impressive title) and social media. They focus on short attentions spans because it's easier to keep someones attention that way. For me this formed some habits which fit short attention spans like opening up a lot of pages and reading small parts of them. For me this lead to fast short term rewards.
Reversing this habit of a short attention span is like an exercise. Staying away from sites which cater to short attention spans and only opening one page at a time which I read completely. In that way I try to learn a new habit. I don't use reddit a lot anymore and I try to use hackernews instead because there are a lot more longer articles here of greater quality, requiring longer attention spans. Maybe that could help you. But all of this is obviously completely personal and anecdotal.
Some things which I found helpful:
Charles Duhigg: The Power of Habit (Book about habits)
The Coursera course: Learning How to Learn (Since learning requires a long attention span)
Ask HN More Like Hackernews: https://news.ycombinator.com/item?id=3734303 Contains a lot of sources like longforms.org, https://aeon.co and https://aldaily.com websites which have content which requires long attention spans.
Possibly there are some things in this post which are a bit unclear I've got a bit of trouble writing English since it's not my native tongue. If you have any questions I'd be happy to answer them.