I am British and therefore hopefully eligible for the VWP. I plan to ship my motorbike to the USA, fly from the UK to meet it there and ride around for three months. Then in order to comply with the VWP I planned to fly to Brazil, spend two weeks there, then fly back into the USA. I wanted to do another three months in the USA before I ship the bike back and fly home. Is there a possibility that they won't let me back in and my bike will be stuck there?!
There is always a possibility you will not be admitted. The visa waiver programme is intended for infrequent, short visits
Immigration may find two entrances at maximum length separated by such a short space of time suspicious. I suspect you would not be denied entry, but you may be subject to extra questioning on your second entry which could take a few hours and be quite unpleasant. You will need to be ready to show that you have a plan to spend your time, that you are a tourist, that you have sufficient funds to sustain yourself, and you do not intend to defeat any immigration rules such as by overstaying or trying to work. It is up to you to prove this, not for US CBP to prove the opposite.
It may be better to obtain a proper B2 six month tourist visa instead.