I'm going through that process as well, as I switch my projects away from coding and back to academic reading and research, which I have not done in 30 years.
What is working for me is to take it slow. To get actual books, not e-books, sit down with them in a cozy reading corner I set up, and read what I can. To go to libraries, browse the stacks, take a few books to a table, and skim through them. Basically, to avoid middle grounds and go all the way back to how I used to read before the web took off. It is not fixing my attention overnight, but I am improving over time.
It also helps to have a focus. Reading for its own sake doesn't give me the endurance I used to have, but deliberate reading to further some research goals helps me get more done.
So I discovered the opposite. My reading was always tied to a goal of some sort. I started reading on a kindle and turning off progress indicators and suddenly I had my attention back. I wasn’t worried about improving or reading a certain amount per day or finishing a book by a certain date. I just read.