This is a great question. It really depends on how many square feet (sf) of office space you need. If your leasing less than 10,000 sf you should start the process of searching for office space at the VERY LEAST 6 months before your existing lease expires or before your ideal move in date. If you are leasing more than 10,000 sf then you'll want to give yourself at least 12 months.
Being proactive will ensure that you and your broker have enough time to find the right space and negotiate the best deal possible. It's tough to create negotiation leverage when you are TOO close to your existing lease expiration. In this situation both your existing landlord (for lease renewal) and your potential landlords (if moving) know you don't have much time and must make a decision as soon as possible, which in turn causes them to not give lease concessions.
Finding the right office space takes longer than you think so don't wait until the last minute or you'll end up not getting the best deal.