The Short Version: There is a red question block on the roof of the rock pavilion. Mario can back-flip up to the top and get a Wing Cap, which can be used to fly to any point in the level.
Just as when playing Lethal Lava Land in Mario 64 “in the old days”, I also found a trick in Shifting Sand Land to simplify certain challenges. In some cases it’s possible to fly directly to a star and in others it just makes it easier to get to other sections without risking the chance of falling into quicksand. Pulling off this trick requires the Wing Cap, which means you’ll need to use Mario.
First, head down to the castle basement and then head left at the painting for Lethal Lava Land. The entrance is hidden in the wall of the dead-end.
At the start of the level head straight toward the rock pavilion.
The next part of the trick is to go to the far end (facing the large area of quicksand and shifting blocks) and back-flip up to the top of the pavilion.
At the top is a red question block, which will give Mario a Wing Cap.
There’s enough room at the top to triple-jump to fly.
It’s also possible to fly to the cannon. If you haven’t talked to the Bob-omb on the far end of the map you can fly out there. The Wing Cap will wear off but there’s a secret warp on the oasis tree, which will warp you back to the canon and a Wing Cap. By grabbing the Wing Cap and leaping into the cannon you’ll be able to gain more height and speed.