The rules are that you have to have your carry bag under the seat in front of you for takeoff and landing. The rules don’t say anything about mid flight.So if you need a little more leg room to stretch out during that flight, after takeoff, move your bag under your knees.
I travel with a pretty small computer bag but it still gets in the way when trying to sleep so after takeoff, I move the bag under my knees or under the slight overhang between the end of my seat and the bar below designed to contain the carryon of the person behind me. Even a large backpack can fit under your knees allowing you to stretch out for some shut eye on a long flight in a middle seat.
My wife does this on car trips in the passenger seat but I never really thought to do it on airplane flights until recently and it works like a charm.
You’ll have to stow everything again for landing but hopefully you’ll be more rested by then.