Unlike in the movies, Frodo never sent Sam home in the novels. They were together for the entire journey until they came across Shelob’s lair. When they made it out, Gollum attacked him which is why he couldn’t help Frodo against Shelob.