The idiom meaning so close that the lead between competitors is indeterminable is neck and neck. It is often incorrectly written neck in neck.
Although some usage authorities recommend always hyphenating neck-and-neck, we can treat this idiom like a typical phrasal adjective. Hyphenate neck and neck when it precedes the noun or phrase it modifies, and leave it unhyphenated when it functions as a predicate adjective. It should also be hyphenated when it functions as an adverb (e.g., they ran neck-and-neck).
Examples
The incorrect neck in neck appears about once for every instance of neck and neck—for example:
Ald. Bernard Stone and challenger Debra Silvertstein were neck-in-neck in votes at Precinct 41 … [Progress Illinois]
In the 4x400m relay, East and Franklin stayed neck-in-neck, strides ahead of everyone else. [Blue Ridge Now]
And these writers use neck and neck correctly (according to the rules for phrasal adjectives):
It was a suspenseful, neck-and-neck race to the finish line. [San Francisco Chronicle]
By the time the official campaign started, Labour and the SNP were neck and neck. [Guardian]
Even the Liberal and Conservative candidates say they are running neck and neck. [Canada.com]
He scored eight straight points in the second half to help Butler break out of a neck-and-neck game with the Rams. [Chicago Tribune]

