Note: the contents of this answer are not actually correct; however, I've been asked to undelete this because it contains content that might be useful.
I'm still trying to work through what I missed, but in essence, I think it comes down to the assumption that Red plays pieces that are adjacent to existing pieces, or do not otherwise interfere with them. I'm not totally sure, though, and I'd definitely be interested in an explanation.
With perfect playing, it is not possible to get four-in-a-row. It is at most possible to get three-in-a-row.
Let's let Player 1 be the player who's trying to achieve a high length using red squares, and Player 2 be the player who's trying to restrict the max length using blue squares. This follows your web example, but I just wanted to establish clear terminology.
It actually makes absolutely no difference what player 1 does in this situation, since it's not possible for player 1 to achieve anything more than a length of 2. Here's what you have to do, as player 2:
Whenever Player 1 makes a move look at all the adjacent squares.
- First, check to see if Red could form a chain of four anywhere on their next move. If such spots exist, fill them in. (There will never be more than two of these at at time - see below.)
- Then, check to see if Red could form a chain of three anywhere on their next move. If any such spots exist, fill them in.
- If neither of the above are true, place Blue squares anywhere next to the square that red just placed.
It's that simple.
How does this work in practice? I'll walk through a few steps.
Step 1: Red makes the first move.
Blue sees that there's a red square, and there are no places where Red could go to create a chain of three. So, per instructions, Blue fills in two squares on opposite sides of the red square.
Step 2: Red tries to break away!
Blue sees that Red has tried to break away diagonally. Since there are two spots opposite each other where Red could break away, Blue fills those in.
Step 3: Red creates more escape routes!
Blue here sees four spaces which could generate chains of three. Since two of them are opposite squares, Blue picks a random pair and fills them in. The result is the same.
Step 4: Red creates a chain of three!
Blue here sees two spots where a four-in-a-row could happen. Blue obviously fills them in.
Why does this work?
Here's an easy explanation that's very intuitive: any time Red could make a 4-chain, they're cut off at both ends. This is actually not simple to demonstrate, though.
What we need to show is that Red can generate at most two openings for a fourth piece to go into at a given time. If there are only two open slots, Blue will fill them on the next turn and the chain will die at length 3.
We know that Red can produce 2-chains, and that Red can produce 3-chains from them. Let's take a closer look at why Red can even do this, and classify it a little. In order to create a 3-chain, Red needs to unify two 2-chains at a common point. (I'll call these linked 2-chains.) Each individual 2-chain only has two openings to expand into 3-chain. However, if we conjoin two of them at a common point, then the resulting group is given not two, but four openings.
In other words, the fundamental property is: a single chain of length two or greater can only have two degrees of movement. (A chain of length 1 can have up to eight, by comparison.) Because the chain must go in a certain direction, at most two possibilities exist: continuing off either end. When we stick them together into linked chains, however, we can at most add those degrees of movement together, and adding two 2-chains' movements together gets us a 2-chain with movement 4.
Here, Red only has two openings to create a new chain. Both of these will be cut off when Blue moves next. However, Red can force Blue into a helpful chain:
How did Red do this? They went first in Cb. Blue blocked some random squares off, then Red went in Cc. Blue necessarily blocked off this chain of two from becoming a chain of three. However, at this point, Red goes in Bc. Bc gives red two unrestricted pairs, (Cb-Bc) and (Cc-Bc). Blue can only stop one of these, so the other will be able to expand into a chain of three.
Why is this important? In order to create a 4-chain, we need to create a linked 3-chain. Each 3-chain only has two degrees of movement, but if we can add them together at once, we can create a linked 3-chain that has at most four degrees of movement. This means that blue can't kill all degrees of movement in the next turn, and Red can play to win.
Easy, right? Turns out it's not possible.
The reason is actually pretty simple: you need to create two 2-chains that are adjacent to each other. You'll get to a position comparable to this:
Blue sees Red place a tile somewhere totally irrelevant. Following the steps in logical order, Blue spots a space where Red could, in theory, create a 4-chain on the next turn. Blue fills that in. Blue then spots a space where red could, in theory, create a 3-chain on the next turn, so Blue fills that in, too.
In other words, you've created a 2-chain. That's fine and good, but now you need to make another one, and doing so consumes six degrees of movement. It takes three moves. Your process creates four degrees of movement, so there's a net loss of two degrees of movement. Where do those two degrees come from? The chain you're trying to link to, on the first turn you try to link to it!
It's theoretically possible, if you already had two existing 2-chains and could link them at a unifying spot. But it's not possible to get to that position; if you tried to create the second 2-chain you need, the first one will be cut off and die.
Thus, it's not possible to get four in a row if Blue plays perfectly. QED.
tl;dr? The maximum-length chain that Red can create is three. There's no possible way to generate a longer-length chain.