Time, patience and will is all you need to stay flexible, but, of course, that's easier said than done.
Practice makes perfect.
This is an old adage, but it's true. I practised and practised doing a headstand for a few months, and now it's as easy as 1, 2, 3. Becoming flexible, however, isn't quite as easy, I know, but practising repeated movements to finally reach that inverted pigeon, or rocking your crow (yoga terms), will result in a perfect form, strong and flexible body.
Take it slow.
Don't suddenly force your body into a certain position - you won't get limber that way. The opposite may happen in fact, if you try to hold your body in a seemingly nimble position - you don't want to do that because it can shut your body down.
Instead, try slowly and surely and your body will naturally, eventually ease into place. Patience is key here
Trying to stretch out a cool body is not fun. Your body doesn't like it and your limbs may feel tight as a result. At least ten minutes of cardio will help to muscle your muscles and you'll become a lot more flexible and able to bend your body that much easier.
To maintain flexibility it is essential to keep your body moving. A stiff body isn't flexible, so keep up the light cardio, stretch out your body and keep at it. Eventually, you'll be as flexible as the next yoga teacher.