Divide et impera, say the ancient romans. You can't work on all that code as a single entity, but if you divide it in many small entities, each with a precise, confined, function, then you can conquer them easily. See, for instance, the Rails application structure. That's a very good example of small files with a semantic structure.
To ensure new features do not break anything you rely on testing. While you develop you write tests, a set of functions with an attended result. For instance, if you program a calculator, you can write a test to tell "hey, 2+2 should be 4". When you add a new functionality you just run your set of tests and see if any of them fail. Tests are usually written on a sample data set, and are often divided into test sets (like, math tests, network tests, and so on). There also an interesting view on programming called test-driven development, where you first write tests, and then implement the function to statisfy those tests.
On a final note, don't be afraid of large numbers, when you see behind the matrix, code starts to flow and you'll be writing thousands of lines without even noticing. Good work.