Google Inc. (GOOG) is buying its Silicon Valley headquarters for $319 million in a deal covering the Internet search leader's nerve center — a cluster of buildings revered in high-tech circles as the "Googleplex."

The Mountain View, Calif-based company disclosed the purchase from four commercial real estate companies in Securities and Exchange Commission documents filed Wednesday. Google wants to close the sale by the end of the month.

Since Google began renting its current headquarters in 2003, the property — located near a former garbage dump — has evolved into a technology temple renowned for hiring some of the world's smartest engineers and pampering its employees with perquisites that include free meals around the clock.

The nearly 1-million-square-foot headquarters also has turned into a wealthy enclave, thanks to Google's high-flying stock.

The shares, which closed Wednesday at $384.39 on the Nasdaq Stock Market, have more than quadrupled from their August 2004 initial public offering, turning hundreds of Google's rank-and-file employees into millionaires as they cashed in some of their holdings.

Google's prosperity contrasts sharply with the previous occupants, Silicon Graphics Inc. The maker of high-powered computers vacated the premises to save money as its revenue plunged and is now trying to reorganize under bankruptcy court protection.

SGI's woes mean the sale of the buildings still requires bankruptcy court approval because the company still has some contractual agreements with the sellers.

Google also needs the approval from the city of Mountain View, which holds ground leases on the land. The company must pay the city $315,000 per month to cover those leases and faces annual rent increases of 4 percent to 7 percent, according to the SEC documents.

Mountain View's ground leases expire in 2050 and 2051.

With the company adding about a dozen new workers a day, Google already had been running out of space at its headquarters.

The squeeze prompted Google to rent nearby buildings and explore other expansion opportunities. To accommodate its anticipated growth, Google last year struck a deal to build another 1-million-square foot campus on the grounds of NASA's Ames Research Center, located just a few miles down the road from its headquarters.

The 7-year-old company already employs more than 7,000 employees and recently listed about 1,800 job openings.