I personally don't have this problem since I never fapped on my bed but from what I heard from other people they either throw their mattress away and get a new one or change the location of their bed. Tbh its all up to you man sometimes you can't avoid triggers but you gotta fight them.
When you recognize that you have an urge, do not ignore it, it will not go away. You can try to acknowledge the fact that you are experiencing an urge, and that this urge is created by your brain because it has nothing else to do, or receive stimulus from. Acknowledging it is different from giving in to it. Remember, the more you focus on not doing PMO, the more PMO becomes something you think of. If you try to distract yourself from thinking about it, the better off you will be. I suggest that you try to do non-sexually related activities that will occupy your mind, or try to exercise a few hours before you go to bed so that you will feel tired and make it easier to sleep.
I can relate. It often takes me over an hour to fall asleep. I never had a routine of PMO before bed but I think it sounds like that might have been a regular thing for you. I'd just do what vapid said, if you can't fall asleep and you keep getting urges, get out of bed and do an activity. Reading a book, quick exercise, listen to music etc. I believe the urges at night should eventually fade away
That's when I reach out to an AP. Usually lonliness, boredem and temptation feed into eachother until you give in. We tend to isolate in those moments when i fact others can help break the cycle much quicker than we can. I know guys reach out to a different AP almost everyday. Personally I find if I'm left to my own devices, I may have said I can refocus my mind on other things, but generally don't in the moment. I'm also Christian so prayer and reading the Bible is big as well. If you need AP feel free to reach out.
I stare at the ceiling and that is all, if you close your eyes you are going to start imagining things.