Roughly 60 days prior to closing most, but not all builders will require you to finalize who you are going to work with. Keeping that in mind, even the "builders preferred lender" might run into an issue and close late. If you are going to work with an outside lender, be sure to get in writing what their policy is on late closings and "per-diem" charges. Some lenders will cover the per-diem if it's the Banks fault. Some Banks will not be as customer friendly on the subject.
At day 65, get the builders lender's "best and final offer" which must include any concessions given by the builder as an incentive to use this lender. Then get 1-2 additional quotes and commit by day 60. Add to your decision tree some of the intangibles like responsiveness, local versus call center, are you working with a refinance shop like CashCall or a purchase focused lender. As said many times here on TI - That "great rate" really doesn't seem so great when the lender blows your deal up.
By day 60, you should have stopped chasing product (LPMI, 80/10/10, rate reductions by depositing money in the funding banks system, etc) have been loan approved and ready to move, and are focused only on price and service. I'd strongly recommend you settle the product question by day 75. If you need a low down program, work out those issues early on with 2-3 lenders, then settle on price by day 60. Don't chase price then ask if a low down option is available. You may have a great rate locked, but now that lenders low down payment product is a stinker. Solve product issues early as they are the largest reason why purchase loans close late. Finally, if you're wanting a "unicorn loan product" - high ratio ARM product, a Bank Statement only product - be sure to be ready for a potential "Plan B" should that unicorn become extinct. All of this goes into the lender decision first, then rate, along with ability to close on time.
Hope this helps.
My .02c
SGIP