You need to focus on drafting clear deliverables and milestones. Make sure to add padding. Be generous with your time estimation. You and the prospect need to agree on what it will take to move it from a pilot to a customer. Factual, black and white milestones.
Not only that. At the end of the pilot period, both parties should have an understanding of when post-pilot pricing kicks in. What metrics have to be met, or on what date, and what is the fee arrangement. Need to have a clear, achievable set of criteria to transition to full paying customer. You may still offer an early customer discount to sweeten the retention, but it should be clear you are out of pilot stage once you meet the mutually agreed criteria.